Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2008
    Forfar, Scotland
    Thanked 39 Times in 39 Posts

    Question 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.

    private var __mywstest:ProviderServices = new __mywstest:ProviderServices();
    __mywstest.addEventListener(ResultEvent.RESULT, mywstestResultEventHandler);
    private function mywstestResultEventHandler(_e:ResultEvent)
    	/* HANDLE RESULT */
    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?

    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.
    private function getActionFromResultEvent(_e:ResultEvent):String
    	var _actionArray:Array = _e.token.message["httpHeaders"].SOAPAction.split("#");
    	return _actionArray[_actionArray.length-1].split("\"")[0];
    This works, but is there a more conventional way to access this information, that I may have overlooked?

  2. #2
    New to the CF scene
    Join Date
    Apr 2011
    Thanked 0 Times in 0 Posts
    did you ever get an answer to that? there MUST be a batter way, surely...?


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts