Hi Chris.
Roughly speaking, you do something like this:
myService.someMethod(arg1, arg2);
myService.addEventListener("result", resultMethod);
Of course, as you illustrate, this will not work if you are calling
multiple methods on myService, because you need a way of figuring out
which method you are getting the result for. As far as I know, you need
to do some of your own plumbing to make this happen.
Here is one way to do it:
function initializeStuff() : void
{
myService.addEventListener("result", resultHandler);
}
function doStuff() : void
{
var call = myService.someMethod(arg1, arg2);
call.resultHandler = actualResultHandler;
}
function resultHandler(event: ResultEvent) : void
{
var call : Object = event.call;
if (call.resultHandler != null)
{
call.resultHandler.call(null, event)
}
}
function actualResultHandler(event: ResultEvent) : void
{
}
-Sho
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Chris Scott
Sent: Friday, March 24, 2006 8:09 AM
To: [email protected]
Subject: [flexcoders] What happened to mx.utils.Deletage?
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
--
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/