box-o-sand/00-custom-03d3-lists/ListApp.as

40 lines
1.0 KiB
ActionScript

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;
}
}
}