Adobe Flex Actionscript Question:
How do you use a repeater in actionscript?
Answers:
Answer #1<mx:Application>
<mx:Script>
<![CDATA[
[Bindable]
public var myArray:Array=[1,2,3,4];
]]>
</mx:Script>
<mx:Panel title="Repeater: emulating a for loop" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10">
<mx:Repeater id="myRep" dataProvider="{myArray}">
<mx:Label id="myLabel" text="This is loop #{myRep.currentIndex}"/>
</mx:Repeater>
</mx:Panel>
</mx:Application>
<mx:Script>
<![CDATA[
[Bindable]
public var myArray:Array=[1,2,3,4];
]]>
</mx:Script>
<mx:Panel title="Repeater: emulating a for loop" paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10">
<mx:Repeater id="myRep" dataProvider="{myArray}">
<mx:Label id="myLabel" text="This is loop #{myRep.currentIndex}"/>
</mx:Repeater>
</mx:Panel>
</mx:Application>
Answer #2the repeater code is correct. but repeater parent should be non absolute container like vbox, hbox, panel (except absoulte path)
Previous Question | Next Question |
How do we call javascript from Flex actionscript? | what are three ways to skin a component in flex? |