Hi All,

>>> don't need that in
2.0 because we have closures which means that the function will maintain
the correct "this" pointer <<<

Sorry for perhaps silly questions... It sounds like AS3 Function object now 
becomes something like thunks in C++, delegates in .NET or mx.utils.Delegate 
in Flex1.5/AS2, so two things now are not very clear as for me:

1) Why do we need the first parameter in Function.call/Function.apply APIs 
also known as "thisObject"? Code prototype used in my tests listed below. I 
was not able to call A.f1 function using B class context, (thisObject 
argument was ignored). Is it possible at all?

<code_snip>

class A { function f1() { trace("this="+this); } }
class B { function f1() { trace("this="+this); } }
...

var a:A = new A();
var b:B = new B();

var fa:Function = a.f1;
var fb:Function = b.f1;

fa(); // -> this=[object A]
fb(); // -> this=[object B]

fa.apply(b); // -> this=[object A] why ???
fa.call(b);    // -> this=[object A] why ???

</code_snip>


2) If all functions are "thunked" in AS3, is it possible to retrieve "this" 
object pointer from Function object using ActionScript code? In other words 
how to find object pointer this function is belong to?

--
Thanks,
Vadim.



----- Original Message ----- 
From: Matt Chotin
To: flexcoders@yahoogroups.com
Sent: Wednesday, February 22, 2006 7:23 AM
Subject: RE: [flexcoders] Delegation and Callbacks


Sorry, I'm not sure I get what you're trying to do.  When you say
delegate do you mean the 1.5 mx.utils.Delegate?  We don't need that in
2.0 because we have closures which means that the function will maintain
the correct "this" pointer.  Or are you looking for a different delegate
class?

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of mvbaffa
Sent: Monday, February 20, 2006 4:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Delegation and Callbacks

Hi everybody,

I have developed an ActionScript class to help synchonize WebService
calls.

You have to create an instance of it in the load event of the
WebService. Then the class initializes some internal data structures
looping through the webservice operations and drives the result
event.

At the initialization process the class receives also a
setupCallback function parameter so that the application can define
methods to be called before the webservice operation is sent and
after the result event is fired. This setupCallback function is
called by the class when it is initializing.

I Would rather use a delegate to communicate with the application.
How can I define and use delegation in Flex 2/ActionScript 3

Thanks in advance






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








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

 Visit your group "flexcoders" on the web.

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

 Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



--
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/
 


Reply via email to