adding example for list control
This commit is contained in:
parent
a55c3e2ed7
commit
b14a4ad07c
52
03d3-lists/ListControl.mxml
Normal file
52
03d3-lists/ListControl.mxml
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
backgroundColor="#FFFFFF"
|
||||
backgroundAlpha="0"
|
||||
horizontalAlign="left"
|
||||
verticalGap="15" horizontalGap="15">
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import mx.collections.ArrayCollection;
|
||||
import mx.rpc.events.ResultEvent;
|
||||
import mx.events.ListEvent;
|
||||
|
||||
[Bindable]
|
||||
private var employeeList:ArrayCollection = new ArrayCollection();
|
||||
|
||||
private function requestEmployees():void {
|
||||
employeesService.send();
|
||||
}
|
||||
|
||||
private function resultHandler(event:ResultEvent):void {
|
||||
employeeList = event.result.employees.employee as ArrayCollection;
|
||||
}
|
||||
|
||||
private function showMessage(event:Event):void {
|
||||
message.text = "You selected: " +
|
||||
event.currentTarget.selectedItem.firstName + ' ' +
|
||||
event.currentTarget.selectedItem.lastName;
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
|
||||
<mx:HTTPService
|
||||
id="employeesService"
|
||||
url="http://www.flexmonkeys.com/F3GSE/PartIII/CRUD/employees.xml"
|
||||
result="resultHandler(event)"
|
||||
/>
|
||||
|
||||
<mx:Button label="Return Employees"
|
||||
click="requestEmployees()" />
|
||||
|
||||
<mx:List id="mylist"
|
||||
labelField="firstName"
|
||||
dataProvider="{employeeList}"
|
||||
width="200" height="200"
|
||||
itemClick="showMessage(event)"/>
|
||||
|
||||
<mx:Text id="message"
|
||||
paddingTop="20" />
|
||||
|
||||
</mx:Application>
|
Loading…
Reference in New Issue
Block a user