Flex 4:Retrieving the action from the ResultEvent in an event handler
I have been using Flex(Flash) Builder 4 now for a little while. It used to be that, when importing web services, fault and result event types were created for each web service in the suite of services supplied by the provider.
In Flex 4, however, these events are not created and you use the generic ResultEvent and FaultEvent. I can see how this may be more efficient but this can lead to a problem.
So far, it is fine, but the format of the result returned from a call to testMethod1 may be different to that returned from testMethod2. So how do you distinguish which method has triggered this resultEvent?
private var __mywstest:ProviderServices = new __mywstest:ProviderServices();
private function mywstestResultEventHandler(_e:ResultEvent)
/* HANDLE RESULT */
The only way I have figured out how to do this is to write the following function. You pass it the resultEvent and it returns a string containing the name of the call that triggered this handler.
This works, but is there a more conventional way to access this information, that I may have overlooked?
private function getActionFromResultEvent(_e:ResultEvent):String
var _actionArray:Array = _e.token.message["httpHeaders"].SOAPAction.split("#");