Re: [Flashcoders] Event Dispatcher

2006-02-18 Thread judah
Can you give an example of the memory leak you are talking about and also an example of the arguments.caller remove listener? I have not heard of this before. Is the memory leak issue caused when you nest a function inside a class? class myClass { function myClass() {

Re: [Flashcoders] Event Dispatcher

2006-02-17 Thread Johannes Nel
yeah. the type property can be whatever, as long as you know what you are listening for all is good. On 2/17/06, Jamie Alpers [EMAIL PROTECTED] wrote: This may be a duh question, but when you use dispatchEvent in a custom created component, can I use my own event name or do i have to use one

Re: [Flashcoders] Event Dispatcher

2006-02-17 Thread Scott Fanetti
If you are using Flex2 , create a custom event that extends from the event class. and inject the namespace for the custom event into the superclass. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive:

Re: [Flashcoders] Event Dispatcher

2006-02-17 Thread Jamie Alpers
Thanks. I relooked at my code and realized i was just making a stupid mistake by confusing object names. it works now :-) On 2/17/06, Johannes Nel [EMAIL PROTECTED] wrote: yeah. the type property can be whatever, as long as you know what you are listening for all is good. On 2/17/06, Jamie

Re: [Flashcoders] Event Dispatcher

2006-02-17 Thread Aaron Smith
Just make sure int he constructor you initialize it:: EventDispatcher.initialize(this).. also you ned to have these var definititions: public var addEventListener:Function public var removeEventListener:Function; private var dispatchEvent:Function then to dispatch: dispatchEvent( {

Re: [Flashcoders] Event Dispatcher

2006-02-17 Thread John Grden
Must resist...the crack...habbit... and if you want to point that dispatched to a custom method not named the same as the event: obj.addEventListener(onWhatever, Delegate.create(this, myCustomMethod)); private function myCustomMethod(evtObj:Object):Void { // code } Also, you don't need

Re: [Flashcoders] Event Dispatcher

2006-02-17 Thread Johannes Nel
what john is outlining here is fine in essence, but unless you never want to remove this event listener this will cause a memory leak. either you create the delegate function on a class scope or you use arguments.caller in the handler function to remove the event listener On 2/17/06, John Grden