Hi Sunil, That won't work if multiple requests are filtering through the same B - which is where the whole problem starts from. :-) Because request 2 overwrites the contextInfo written by request 1 - which is why both Muzak (and I) suggested B has an internal list of contextInfos. But that gets more tricky...
But thanks! Ian On 7/25/07, Sunil Jolly <[EMAIL PROTECTED]> wrote:
Hi Ian, I didn't fully understand your reply to Muzak's suggestion, but this is based on that and seems to fit the bill. Sorry it's a bit messy but you get the idea... Are there still issues with this one? ------- //call class b passing extra param var b:B = new B(); b.addEventListener(Event.COMPLETE, onBComplete); b.loadSomethingAndProcessIt("url.swf", someParameter); function onBComplete(event:Event) { var thingYouWant:Object = event.customEventValue; } //Class B based on Muzak's(thanks!) >> class B { >> private var contextInfo:Object; >> public function loadSomethingAndProcessIt(url:String, ontextInfo:Object):void{ >> contextInfo = contectInfo; >> r a:A = new A(); >> a.addEventListener(Event.COMPLETE,onALoaded); >> a.loadSomething(url); >> } >> >> function onALoaded(event:Event):void { >> dispatchEvent(new CustomEvent(contextInfo)); >> } >> >> } //Custom Event to be fired from Class B package etc... public class CustomEvent extends Event { private var customEventValue:Object; Function CustomEvent(contextInfo) { super(etc...) customEventValue = contextInfo; } } Sunil -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas Sent: 25 July 2007 14:16 To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] AS3 Events Oh, and reading the link you supplied, the only concrete suggestion is from Aral Balkan, who suggests (as someone did in an earlier thread) that you subclass the Event class. How would that help in my case? Any suggestions? To go back to my original example, if you assume class A is a black box that fires an event of class Event (Event.COMPLETE), we have no way (to the best of my knowledge) to make class A produce subclasses of Event instead; unless the suggestion is to subclass A to produce different events, which (depending on A's implementation) could be very difficult. Ian (Getting frustrated!) On 7/25/07, Ian Thomas <[EMAIL PROTECTED]> wrote: > On 7/25/07, Sunil Jolly <[EMAIL PROTECTED]> wrote: > > Hi Ian, > > > > It seems like the "proper" way would be to create the extra > > functions/classes to handle this. That would solve those two issues > > which aren't major, but would make your code cleaner. _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com