温故而知新,简简单单的写了一个例子。以后会在注图形化处理方面多写些例子.
源码:
复制代码 代码如下:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalAlign="top" applicationComplete="init()">
<mx:Script>
<>
</mx:Script>
<mx:Form>
<mx:Text text="联系簿" fontWeight="bold" fontSize="14" textAlign="center" width="233" color="#1B78C6"/>
<mx:FormItem label="姓名" fontSize="12" fontWeight="bold" horizontalAlign="left">
<mx:TextInput id="uname"/>
</mx:FormItem>
<mx:RadioButtonGroup id="sexgroup" itemClick="changsex(event)"/>
<mx:FormItem label="性别" horizontalAlign="center" fontSize="12" fontWeight="bold">
<mx:HBox>
<mx:RadioButton id="male" label="男性" groupName="sexgroup" selected="true" value="m"/>
<mx:RadioButton id="female" label="女性" groupName="sexgroup" value="f"/>
</mx:HBox>
</mx:FormItem>
<mx:FormItem label="电话号码" fontWeight="bold" fontSize="12" horizontalAlign="center">
<mx:TextInput id="uphone"/>
</mx:FormItem>
<mx:HBox width="232" height="35" verticalAlign="middle" horizontalAlign="center">
<mx:Button id="go" label="添加" fontSize="12" fontWeight="normal" click="checkuser(event)" textAlign="center" height="30" width="60"/>
<mx:Button id="reset" label="重置" fontWeight="normal" fontSize="12" height="30" width="60" click="resetvalue(event)"/>
</mx:HBox>
</mx:Form>
<mx:DataGrid dataProvider="{dataColl}" width="400" id="userdata"
fontSize="12" border fontWeight="bold" textAlign="center" alternatingItemColors="[#F1B6B6, #F2EB37]" height="210" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="uid"/>
<mx:DataGridColumn headerText="联系人" dataField="uname"/>
<mx:DataGridColumn headerText="性别" dataField="usex"/>
<mx:DataGridColumn headerText="电话号码" dataField="uphone"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>