here is the as3 tech note:
http://labs.macromedia.com/wiki/index.php/ActionScript_3:overview#Delegation



On 3/24/06, Johannes Nel <[EMAIL PROTECTED]> wrote:
i am not 100% certain i understand what you mean (heads a bit thick with anti-flu medicine) but here is a nice rule of thumb.
once a class is instantiated the "this" property is always the same no matter where you call it from (google method closures)


On 3/24/06, Chris Scott < [EMAIL PROTECTED]> wrote:
I didn't entirely understand your answer, but now that I tried this, it works, and your answer made more sense:

var pendingCall = myService.someMehtod(arg:Type, arg2:Type);
pendingCall.resultHandler = resultMethod;

The RemoteObject, myService is being created in the main app, this code is being used in a component. So I see that the scope issues are taken care of automatically, which is nice. The reason I am doing this is because my services will be passed into each component by the main app, so if different components need to call the same methods, I need local result handlers.


On Mar 24, 2006, at 11:15 AM, Johannes Nel wrote:

delegates are build into as3, so if you assign an event handler it will execute in the right scope. i cannot help you with WS implementation in AS3 yet.

On 3/24/06, Chris Scott < [EMAIL PROTECTED]> wrote:
Hi, long time reader first time poster. OK, just started reading
yesterday, but anyway. First off, I am working with Flex 2 Beta 2

I'm trying to add resultHandlers to async method calls at method
invocation time (this approach is outlined in the 'Developing Rich
Clients with Flex' book). I have also done a very similar approach
with Flash and Remoting. So code that used to work is like this:

var pendingCall = myService.someMehtod(arg:Type, arg2:Type);
pendingCall.resultHandler = mx.utils.Delegate.create(this,
resultMethod);

with result method being some local method. Anyway, now I can't
locate the mx.utils.Delegate class for one thing. I did, through
viewing errors, find that the pendingCall object with be of type
'mx.rpc.AsyncToken', I tried to addEventListener, but I still got an
error that resultHandler was not set on the pendingCall. Anyone have
any good ideas here? How do I properly attach a resultHandler to an
AsyncToken in Flex 2 Beta 2?

Thanks for the help!


Chris Scott
[EMAIL PROTECTED]
http://cdscott.blogspot.com/
http://www.coldspringframework.org/



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/














--
j:pn
http://www.lennel.org


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




YAHOO! GROUPS LINKS

  •  To unsubscribe from this group, send an email to:
      [EMAIL PROTECTED]
     
  •  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.






  • --
    j:pn
    http://www.lennel.org



    --
    j:pn
    http://www.lennel.org


    --
    Flexcoders Mailing List
    FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
    Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




    SPONSORED LINKS
    Web site design development Computer software development Software design and development
    Macromedia flex Software development best practice


    YAHOO! GROUPS LINKS




    Reply via email to