Starling and Feathers Extensions AS3 DocumentationAll Packages | All Classes | Index | Frames
Package
 

Public Methods
 FunctionDefined By
  
factoryFromInstance(instance:*):Function
Creates a sub-component factory from an instance defined in an <fx:Declarations> element.
feathers.utils.mxml
Function detail
factoryFromInstance()function
public function factoryFromInstance(instance:*):Function

Creates a sub-component factory from an instance defined in an <fx:Declarations> element. May be used as an alternative to <fx:Component> to avoid requiring outerDocument to access ActionScript code, but only if one instance is required.

In the following example, an instance of a Header component is passed to the headerFactory property of a Panel component using factoryFromInstance().

<f:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:f="library://ns.feathersui.com/mxml"
    headerFactory="{factoryFromInstance(customHeader)}">
    <fx:Declarations>
        <f:Header id="customHeader">
            <f:leftItems>
                <fx:Vector type="starling.display.DisplayObject">
                    <f:Button label="Back"/>
                </fx:Vector>
            </f:leftItems>
        </f:Header>
    </fx:Declarations>
</f:Panel>

Parameters

instance:*

Returns
Function