将ViewStack的选中索引数绑定到一个变量上
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"
click="changeViewStack()">//不停点击,循环变化
<mx:Script>
<![CDATA[
[Bindable]
private var selectedIndexInt:int=0;
private function changeViewStack():void{
if(selectedIndexInt==2){
selectedIndexInt=0;
}else{
selectedIndexInt++;
}
}
]]>
</mx:Script>
<mx:ViewStack selectedIndex="{selectedIndexInt}">
<mx:HBox height="{this.height}" width="{this.width}">
<mx:Label text="First View Item"/>
<mx:Label text="First View Item"/>
</mx:HBox>
<mx:VBox height="{this.height}" width="{this.width}">
<mx:Label text="Second View Item"/>
<mx:Label text="Second View Item"/>
</mx:VBox>
<mx:Canvas height="{this.height}" width="{this.width}">
<mx:Label text="Third View Item"/>
<mx:Label text="Third View Item"/>
</mx:Canvas>
</mx:ViewStack>
</mx:Canvas>
ViewStack
最新推荐文章于 2019-03-19 16:02:23 发布