<?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" creationComplete="init()" xmlns:layout="org.osmf.layout.*"> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.events.CloseEvent; [Bindable] private var dg:ArrayCollection = new ArrayCollection([{id:1,name:"張三",sex:"男"},{id:2,name:"李四",sex:"男"},{id:3,name:"王麻子",sex:"男"},{id:4,name:"王五",sex:"男"}]); public function init():void{ this.addEventListener("clit",it) } protected function btn_1(event:MouseEvent):void { dispatchEvent(new Event("clit")); } private function it(e:Event):void{ Alert.show("你正在查詢","查詢",1|2,this,ttf); } private function ttf(e:CloseEvent):void { trace(e.detail.toString()); } ]]> </fx:Script> <fx:Metadata> [Event(name="clit", type="flash.events.Event")] </fx:Metadata> <fx:Declarations> <!-- 將非可視元素(例如服務、值對象)放在此處 --> </fx:Declarations> <s:layout> <s:VerticalLayout> </s:VerticalLayout> </s:layout> <s:Button label="查詢" click="btn_1(event)" /> <s:ComboBox id="ts" dataProvider="{dg}" labelField="name" selectedIndex="0" /> <s:CheckBox label="男"/> <s:CheckBox label="女"/> <s:CheckBox label="無性別"/> <mx:LinkButton label="http://localhost:8080"/> <mx:Text text=" 抗打擊對方 的客服都是"> </mx:Text> <s:TextArea text="你的煩惱 苦苦奮鬥" editable="true"> </s:TextArea> <mx:DataGrid dataProvider="{dg}"> <mx:columns> <mx:DataGridColumn dataField="id" headerText="ID"/> <mx:DataGridColumn dataField="name" headerText="姓名"/> <mx:DataGridColumn dataField="sex" headerText="性別"/> </mx:columns> </mx:DataGrid> <s:List dataProvider="{dg}" labelField="name" width="100" height="40"></s:List> <mx:VBox width="200" height="209"> <mx:Repeater id="ift" dataProvider="{dg}"> <mx:CheckBox label="{ift.currentItem.name}"/> </mx:Repeater> </mx:VBox> </s:Application>