flex省市的comboBox下拉级联的数据即时绑定

 

http://www.adobe.com/2006/mxml" layout="absolute" fontSize="14">

                                        import mx.collections.ArrayCollection;
                        import mx.controls.Alert;
                        //省份改变时候,对应的城市也变化
                        public var cbo:Array;
                        public var sheng:String;
                        [Bindable]
                        public var City:Array=['--请选择--'];
                        public function fnchange(evt:Event):void{
                                sheng=cboSheng.selectedLabel.toString();
                                if(sheng=='湖北省'){
                                         cbo=['武汉市','十堰','襄樊','宜昌','鄂州','孝感','恩施','黄石','丹江口','老河口'];
                                }
                                if(sheng=='湖南省'){
                                         cbo=['长沙市','衡阳','岳阳','株洲','湘潭','岳塘','邵阳','临湘','常德','邵东'];
                                }
                                if(sheng=='河南省'){
                                         cbo=['安阳','鹤壁','济源 ','焦作','洛阳','开封','南阳','商丘',' 信阳 ','周口'];
                                }
                                if(sheng=='河北省'){
                                         cbo=['石家庄',' 唐山','廊坊','邢台',' 邯郸',' 衡水',' 张家口','秦皇岛',' 沧州','保定'];
                                }
                                if(sheng=='江西省'){
                                         cbo=['南 昌','景德镇','萍 乡','新 余 ','九 江','瑞昌','鹰 潭','赣 州 ','瑞金','吉 安 '];
                                }
                                if(sheng=='辽宁省'){
                                         cbo=['沈阳','大连','鞍山','海城','本溪','丹东','东港','锦州','凌海','营口'];
                                }
                                if(sheng=='吉林省'){
                                         cbo=['吉林','长春','四平','通化','白山','松原','白城','江源',' 临江',' 集安'];
                                }
                                if(sheng=='浙江省'){
                                         cbo=['衢州市','杭州市','湖州','嘉兴','宁波','绍兴','台州','温州','丽水','金花'];
                                }
                                if(sheng=='黑龙江省'){
                                         cbo=['哈尔滨','阿城','尚志',' 双城','五常','齐齐哈尔','讷河','富裕','泰来','依兰'];
                                }
                                if(sheng=='广东省'){
                                         cbo=['广州','深圳','东莞',' 珠海','中山','佛山','汕头','韶关','惠州'];
                                }
                                City=cbo;
                        }     
                       
                ]]>
      

      
           --请选择--
           湖北省
           湖南省
           广东省
           河南省
           河北省
           江西省
           辽宁省
           吉林省
           浙江省
           黑龙江省
       

      
      

       

你可能感兴趣的:(flex,string,application,import,encoding,function)