Starling and Feathers Extensions AS3 Documentation | All Packages | All Classes | Index | Frames | ![]() |
Package | Functions | |
Function | Defined By | ||
---|---|---|---|
factoryFromInstance(instance:*):Function
Creates a sub-component factory from an instance defined in an
<fx:Declarations> element. | feathers.utils.mxml |
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:* |
Function |