R – load multiple swf in HorizontalList, Flex3 Air application

actionscript-3airapache-flex

I need to load multiple swf in a list like control so that I can load all the swf from the folder and show them to the user, then the user can select any one and view it.

How can I load swf in HorizontalList in Flex3, please send me any example or link regarding this requirement.

Thanks in advance.

Best Answer

Store the urls of swfs in an array and use it as dataProvider of the list. Use Image as the itemRenderer and assign data as the source url.

//script
[Bindable]
private var urls:Array = ["a.swf", "b.swf", "c.swf"];
//mxml
<mx:HorizontalList dataProvider="{urls}">
 <mx:itemRenderer>
  <mx:Component>
   <mx:Image source="{data}"/>
  </mx:Component>
 </mx:itemRenderer>
</mx:HorizontalList>

PS: Wouldn't it be better show thumbnails and load the swf only when user selects one? It would save a lot of bandwidth.

Related Topic