• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

callResponder.lastResult vs event.result...

New Here ,
May 06, 2010 May 06, 2010

Copy link to clipboard

Copied

In the piece of code below I would like to know the difference between doing this:

protected function servicesmainService_resultHandler(event:ResultEvent):void
{
    services = getTopServicesmainResult.lastResult;
 

and this ...
    services = event.result; (which won't compile)

}

Where services is an instance of ArrayCollection, the event comes from the result of a callResponder instance and the getTopServicesmainResult is the same callResponder id?

In debug the elements (ArrayCollection of valueObjects) all look the same, so which is better practice?

Also is it better practice to handle the result event from the callResponder as I'm doing here or from the rpc data service instance?

Thanks in advance,

JP.

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 25, 2010 May 25, 2010

Copy link to clipboard

Copied

LATEST

Hi,

CallResponder.lastResult - This is untyped. Hence there are no compiler errors in that statement. This is bindable. Which means that if you hook it to a datagrid,etc everytime a call is made the datagrid will change its values in accordance with the most recent result.

event.result - The default returned type is Object whereas the variable services in your example is of type ArrayCollection. Hence to make that succesfully compile the change required is

                              services = event.result as ArrayCollection;


About your query regarding handling of events. If you assign a result event for a callResponder, then the event handler is called only when the operation associated with the callResponder is invoked. On the other hand, if you assign a result event to the rpc data service instance, then the event handler is called when any operation within that service is invoked. 

My practice is to handle result events USING Callresponders(as it varies between operations) and handle fault events using RPC data service instance.

Hope this helps and that I understood your questions correctly.

Nishad

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines