datagrid和combobox简单应用
<?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"> <s:layout> <s:BasicLayout/> </s:layout> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; private var combo:ArrayCollection = new ArrayCollection([ {label:"请选择"}, {label:"张三"}, {label:"赵柯"}, {label:"王雷"}, {label:"李梅"} ]); private var datagrid:ArrayCollection = new ArrayCollection([ {name:"张三",age:18,number:1001}, {name:"赵柯",age:18,number:1002}, {name:"王雷",age:18,number:1003}, {name:"李梅",age:18,number:1004} ]); ]]> </fx:Script> <fx:Declarations> </fx:Declarations> <mx:Image x="325" y="69" width="150" height="104"/> <mx:DataGrid x="315" y="43" dataProvider="{datagrid}"> <mx:columns> <mx:DataGridColumn headerText="姓名" dataField="name"/> <mx:DataGridColumn headerText="年龄" dataField="age"/> <mx:DataGridColumn headerText="序号" dataField="number"/> </mx:columns> </mx:DataGrid> <s:ComboBox x="674" y="45" dataProvider="{combo}" selectedIndex="0"/> </s:Application>