创建联动下拉列表.
原理很简单,改变数据源
示例:
代码:
示例:
代码:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
<mx:XML id="dp" source="countries_states.xml" format="e4x" />
<mx:Form>
<mx:FormItem label="Country:">
<mx:ComboBox id="countryCB" dataProvider="{dp.country}" labelField="@name" />
</mx:FormItem>
<mx:FormItem label="State:">
<mx:ComboBox id="stateCB" dataProvider="{countryCB.selectedItem.state}" />
</mx:FormItem>
</mx:Form>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white">
<mx:XML id="dp" source="countries_states.xml" format="e4x" />
<mx:Form>
<mx:FormItem label="Country:">
<mx:ComboBox id="countryCB" dataProvider="{dp.country}" labelField="@name" />
</mx:FormItem>
<mx:FormItem label="State:">
<mx:ComboBox id="stateCB" dataProvider="{countryCB.selectedItem.state}" />
</mx:FormItem>
</mx:Form>
</mx:Application>