<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:XML source="data.xml" format="e4x" id="xmldata" />
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
protected function button1_clickHandler(event:MouseEvent):void
{
var resultPass:String = publisher.selectedItem.x.@name;//得到坐标
//xmldata.category.publisher.x.@name;
//Alert.show(resultPass);
}
]]>
</fx:Script>
<mx:Panel title="下拉框联动" width="300" height="300" horizontalAlign="center">
<mx:Form>
<mx:FormItem label="house:">
<mx:ComboBox id="bookclass" dataProvider="{xmldata.category}" labelField="@name"/>
</mx:FormItem>
<mx:FormItem label="type:">
<mx:ComboBox id="publisher" dataProvider="{bookclass.selectedItem.publisher}" labelField="@name"/>
</mx:FormItem>
<mx:FormItem label="x:">
<mx:ComboBox id="bookname" dataProvider="{publisher.selectedItem.x}" labelField="@name"/>
</mx:FormItem>
</mx:Form>
</mx:Panel>
<s:Button label="ee" click="button1_clickHandler(event)"/>
</s:Application>
//xml数据
<?xml version="1.0" encoding="utf-8"?>
<books>
<category name="维义楼">
<publisher name="教学楼">
<x name="112.33"/>
<y name="26.33"/>
</publisher>
<publisher name="教学楼1">
<x name="22112.33"/>
<y name="2226.33"/>
</publisher>
</category>
<category name="方荫楼">
<publisher name="实验室">
<x name="112.33"/>
<y name="26.33"/>
</publisher>
</category>
<category name="名达楼">
<publisher name="艺术室">
<x name="112.33"/>
<y name="26.33"/>
</publisher>
</category>
</books>
06-08
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交