custom version or 03d3 with separation of mxml/as
This commit is contained in:
parent
33d7222af5
commit
5512886854
39
00-custom-03d3-lists/ListApp.as
Normal file
39
00-custom-03d3-lists/ListApp.as
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package
|
||||||
|
{
|
||||||
|
import mx.core.Application;
|
||||||
|
|
||||||
|
import mx.collections.ArrayCollection;
|
||||||
|
import mx.rpc.events.ResultEvent;
|
||||||
|
import mx.events.ListEvent;
|
||||||
|
import mx.rpc.http.HTTPService;
|
||||||
|
import mx.controls.Text;
|
||||||
|
|
||||||
|
public class ListApp extends Application
|
||||||
|
{
|
||||||
|
[Bindable]
|
||||||
|
public var employeeList:ArrayCollection = new ArrayCollection();
|
||||||
|
public var employeesService:HTTPService;
|
||||||
|
public var textMessage:Text;
|
||||||
|
|
||||||
|
function ListApp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function requestEmployees():void
|
||||||
|
{
|
||||||
|
employeesService.send();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resultHandler(event:ResultEvent):void
|
||||||
|
{
|
||||||
|
employeeList = event.result.employees.employee as ArrayCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showMessage(event:Event):void
|
||||||
|
{
|
||||||
|
textMessage.text = "You selected: " +
|
||||||
|
event.currentTarget.selectedItem.firstName + ' ' +
|
||||||
|
event.currentTarget.selectedItem.lastName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
26
00-custom-03d3-lists/ListControl.mxml
Normal file
26
00-custom-03d3-lists/ListControl.mxml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<loc:ListApp xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||||
|
xmlns:loc="*"
|
||||||
|
backgroundColor="#FFFFFF"
|
||||||
|
backgroundAlpha="0"
|
||||||
|
horizontalAlign="left"
|
||||||
|
verticalGap="15" horizontalGap="15">
|
||||||
|
|
||||||
|
<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="textMessage"
|
||||||
|
paddingTop="20" />
|
||||||
|
|
||||||
|
</loc:ListApp>
|
Loading…
Reference in New Issue
Block a user