In the Flex 2 Developers Guide, it shows an example of how to script a
remote object as follows:
 
employeeRO = new RemoteObject();
employeeRO.destination = "SalaryManager";
employeeRO.getList.addEventListener("result",getListResultHandler);
employeeRO.addEventListener("fault", faultHandler);
employeeRO.getList(deptComboBox.selectedItem.data);
 
Does anyone know how to do the same thing but implement it so the method
name is variable? Like this:
 
var methodName:String = "getList";
employeeRO = new RemoteObject();
employeeRO.destination = "SalaryManager";
employeeRO[methodName].addEventListener("result",getListResultHandler);
employeeRO.addEventListener("fault", faultHandler);
employeeRO[methodName].(deptComboBox.selectedItem.data);
 
It fails on the sixth line here (the second variable call) with this error:
 
Error #1006: value is not a function.
 
It appears the first attempt correctly creates the
mx.rpc.remoting::Operation object, but when you attempt to actually run the
service method it fails.  Any ideas?
 

Reply via email to