Call remote method with RemoteObject
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" verticalGap="10">
<mx:Script>
import mx.utils.ArrayUtil;
</mx:Script>
<mx:RemoteObject id="employeeRO" destination="roDest" showBusyCursor="true" fault="mx.controls.Alert.show(event.fault.faultString, 'Error');">
<mx:method name="getList">
<mx:arguments>
<deptId>{dept.selectedItem.data}</deptId>
</mx:arguments>
</mx:method>
</mx:RemoteObject>
<mx:ArrayCollection id="employeeAC" source="{ArrayUtil.toArray(employeeRO.getList.lastResult)}" />
<mx:HBox>
<mx:ComboBox id="dept" width="150">
<mx:dataProvider>
<mx:ArrayCollection>
<mx:source>
<mx:Object label="A" data="A param" />
<mx:Object label="B" data="B param" />
<mx:Object label="C" data="c param" />
</mx:source>
</mx:ArrayCollection>
</mx:dataProvider>
</mx:ComboBox>
<mx:Button label="Get" click="employeeRO.getList.send()" />
</mx:HBox>
<mx:DataGrid dataProvider="{employeeAC}" width="100%">
<mx:columns>
<mx:DataGridColumn dataField="name" headerText="Name" />
<mx:DataGridColumn dataField="phone" headerText="Phone" />
<mx:DataGridColumn dataField="email" headerText="Email" />
</mx:columns>
</mx:DataGrid>
</mx:Application>
Related examples in the same category