Not exactly sure what you mean by multicasts. Do you mean
multicasting for events? If so, that already exists.
myService.addEventListener("result",
resultHandler1);
myService.addEventListener("result", resultHandler2); //
both of these will be called.
myService.myMethod();
The problem I was talking
about occurs when you call multiple methods on the same service object.
function
callStuff()
{
myService.myFirstMethod();
myService.addEventListenter("result", myFirstHandler);
myService.mySecondMethod();
myService.addEventListener("result", mySecondHandler);
}
function
myFirstHandler(event: Event)
{
//
this gets called when either myFirstMethod() or mySecondMethod() returns a
result.
}
function
mySecondHandler(event: Event)
{
//
this gets called when either myFirstMethod() or mySecondMethod() returns a
result.
}
There may be a way that
multicasts can help here, but I can't figure it out...
-Sho
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Richard Leggett
Sent: Friday, March 24, 2006 9:31 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] What happened to mx.utils.Deletage?
>Of course, as
you illustrate, this will not work if you are calling
>multiple methods on myService
>multiple methods on myService
Any clues as to whether multicasts are in the spec for
AS?
Thanks,
Rich
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Sho Kuwamoto
Sent: 24 March 2006 17:25
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] What happened to mx.utils.Deletage?
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
--
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
- 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.