main.mxml
- <?xml version="1.0"?>
- <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Script>
- <![CDATA[
- import mx.events.ItemClickEvent;
- import mx.controls.tabBarClasses.Tab;
- private function tabBar_creationComplete():void {
- var colorArr:Array = ["red", "haloOrange", "yellow", "haloGreen", "haloBlue"];
- var color:String;
- var tab:Tab;
- var idx:uint;
- var len:uint = tabBar.dataProvider.length;
- for (idx = 0; idx < len; idx++) {
- var i:int = idx % colorArr.length;
- color = colorArr[i];
- tab = Tab(tabBar.getChildAt(idx));
- tab.setStyle("fillColors", [color, "white"]);
- tab.setStyle("fillAlphas", [1.0, 1.0]);
- tab.setStyle("backgroundColor", color);
- }
- }
- private function tabBar_itemClick(evt:ItemClickEvent):void {
- viewStack.selectedIndex = evt.index;
- }
- ]]>
- </mx:Script>
- <mx:Arrayid="arr">
- <mx:Objectlabel="Red" />
- <mx:Objectlabel="Orange" />
- <mx:Objectlabel="Yellow" />
- <mx:Objectlabel="Green" />
- <mx:Objectlabel="Blue" />
- </mx:Array>
- <mx:TabBarid="tabBar"
- dataProvider="{arr}"
- creationComplete="tabBar_creationComplete();"
- itemClick="tabBar_itemClick(event);"/>
- <mx:ViewStackid="viewStack"
- width="{tabBar.width}"
- styleName="plain">
- <mx:VBoxid="redVBox" width="100%" height="100">
- <mx:Labeltext="Red VBox" />
- </mx:VBox>
- <mx:VBoxid="orangeVBox" width="100%" height="100">
- <mx:Labeltext="Orange VBox" />
- </mx:VBox>
- <mx:VBoxid="yellowVBox" width="100%" height="100">
- <mx:Labeltext="Yellow VBox" />
- </mx:VBox>
- <mx:VBoxid="greenVBox" width="100%" height="100">
- <mx:Labeltext="Green VBox" />
- </mx:VBox>
- <mx:VBoxid="blueVBox" width="100%" height="100">
- <mx:Labeltext="Blue VBox" />
- </mx:VBox>
- </mx:ViewStack>
- </mx:Application>
517

被折叠的 条评论
为什么被折叠?



