Flex 在 ViewStack中使用 Repeater实现动态加载系统的不同模块
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" backgroundGradientColors="[#ffffff, #ffffff]"
width="709" height="488">
<mx:ToggleButtonBar x="10" y="10" width="433" height="31" dataProvider="viewstack1">
</mx:ToggleButtonBar>
<mx:ArrayCollection id="Pages">
<mx:Object Label="Action1" Data="1.swf"/>
<mx:Object Label="Action2" Data="2.swf"/>
<mx:Object Label="Action3" Data="3.swf"/>
<mx:Object Label="Action4" Data="4.swf"/>
</mx:ArrayCollection>
<mx:ViewStack x="10" y="49" id="viewstack1" width="433" height="232">
<mx:Repeater id="rp" dataProvider="{Pages}">
<mx:VBox label="{rp.currentItem.Label}" width="100%" height="100%" >
<mx:SWFLoader source="{rp.currentItem.Data}" x="0" y="0" width="404" height="159" autoLoad="true"/>
</mx:VBox>
</mx:Repeater>
</mx:ViewStack>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" backgroundGradientColors="[#ffffff, #ffffff]"
width="709" height="488">
<mx:ToggleButtonBar x="10" y="10" width="433" height="31" dataProvider="viewstack1">
</mx:ToggleButtonBar>
<mx:ArrayCollection id="Pages">
<mx:Object Label="Action1" Data="1.swf"/>
<mx:Object Label="Action2" Data="2.swf"/>
<mx:Object Label="Action3" Data="3.swf"/>
<mx:Object Label="Action4" Data="4.swf"/>
</mx:ArrayCollection>
<mx:ViewStack x="10" y="49" id="viewstack1" width="433" height="232">
<mx:Repeater id="rp" dataProvider="{Pages}">
<mx:VBox label="{rp.currentItem.Label}" width="100%" height="100%" >
<mx:SWFLoader source="{rp.currentItem.Data}" x="0" y="0" width="404" height="159" autoLoad="true"/>
</mx:VBox>
</mx:Repeater>
</mx:ViewStack>
</mx:Application>