flex Switch跳转语句
<?xml version="1.0" encoding="utf-8"?><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"><mx:Script> <![CDATA[import mx.collections.ArrayCollection; import mx.controls.*; import mx.events.*; import mx.controls.TextInput; import mx.containers.VBox; import flash.display.Sprite; import flash.events.MouseEvent; [Bindable] public var cards:ArrayCollection = new ArrayCollection( [ {label:"中文", data:1}, {label:"English", data:2}, {label:"其它",data:3}, {label:"china",data:4}, {label:"长度",data:5}, {label:"vbox 消失",data:6}, {label:"textarea 消失",data:7}, {label:"估计也是default一样的结果",data:8}]); private function vbox_addChild():void { var texti:TextInput = new TextInput(); vbox.addChild(texti); } protected function combobox2_changeHandler(event:ListEvent):void { //中文 // if(cb.selectedItem.data == 3) // { // hidden(); //ac.text = "中文"; // } //English // else // { // ac.text = "English"; // } switch(cb.selectedIndex) { case 0: add(); break; case 1: hidden(); break; case 2: nihao(); break; case 3: hao(); break; case 4: length(); break; case 5: runover(); break; //case 6: //traceName(); //break; default: up(); break; } } protected function init():void { if(ad.selectedItem=="china"){ ac.text="选中了 china"; Alert.show("选中其它"); } else{ ac.text="没有选中 china"; trace(ac.text); } } public function add():void { var textinput:TextInput=new TextInput(); vbox.addChild(textinput); } public function hidden():void { txt.visible=true; } public function nihao():void { ac.text="3你好吗?" } public function hao():void { ttt.text="欢迎大家的关林,这里是您的海洋!" } public function length():void { //var newColor:color = new Color(); bt.width=500; // bt.fillColors="[red, haloOrange, haloGreen, haloBlue]"; //bt.color="0x0B333C"; } public function runover():void { vbox.visible=false; //vbox.width="100%"; } public function up():void { ttt.visible=false; } ]]> </mx:Script><mx:Style> Alert{ fontSize:"14"; fontFamily:"宋体"; }</mx:Style><mx:VBox id="vbox" width="958" height="555" > <mx:Panel width="100%" height="100%" layout="absolute"> <mx:ComboBox id="cb" change="combobox2_changeHandler(event)" dataProvider="{cards}" width="243" selectedIndex="-1" x="10" y="10"/> <mx:Label width="100" text="TEXT。。。" id="ac" x="311" y="12"/> <mx:Button id="bt" label="观察长短的变化" width="159" x="270" y="179"/> <mx:TextInput id="txt" creationComplete="txt.visible=false" x="29" y="189"/> <mx:TextArea x="632" y="254" width="253" height="213" id="ttt"/> <mx:ComboBox x="632" y="12" id="ad" change="init()" dataProvider="{cards}"></mx:ComboBox> </mx:Panel></mx:VBox></mx:Application>