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

 
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" fontSize="14">
<mx:Script>
                <![CDATA[
                        imp ort mx.collections.ArrayCollection;
                        imp ort 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;
                        }     
                       
                ]]>
       </mx:Script>
       <mx:ComboBox x="78" y="69" width="145" height="45" id="cboSheng" change="fnchange(event)" >
           <mx:String>--请选择--</mx:String>
           <mx:String>湖北省</mx:String>
           <mx:String>湖南省</mx:String>
           <mx:String>广东省</mx:String>
           <mx:String>河南省</mx:String>
           <mx:String>河北省</mx:String>
           <mx:String>江西省</mx:String>
           <mx:String>辽宁省</mx:String>
           <mx:String>吉林省</mx:String>
           <mx:String>浙江省</mx:String>
           <mx:String>黑龙江省</mx:String>
        </mx:ComboBox>
       <mx:ComboBox x="264" y="69" width="149" height="45" id="cobCity" dataProvider="{City}">
       </mx:ComboBox>
       
</mx:Application>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值