Well, if you consider that adding a static function and a static variable to
get the Singleton working is a crazy amount of code, I'd have to agree with
you... Because the rest, well, it's just the same, with the difference that
I'm using a "named" event (for lack of a better word, I mean public static
var EVENT_NAME:String) and that I actually wrote a sample implementation to
register for the event and dispatching it.

This is debatable, but I personally prefer to avoid extending MovieClip in
AS 2, as a general rule. However, in this scenario you're loading an swf
into an empty MovieClip (which extends ObservableClip, if I didn't get you
wrong). That means that when the swf is loaded, your "stager" empty
MovieClip has lost all of its properties and is just a plain regular
MovieClip, so you won't be able to dispatch events from it (since it's not
anymore an ObservableClip). Or maybe I missing something here...

Cheers
Juan Pablo Califano


2008/8/17, Steven Sacks <[EMAIL PROTECTED]>:
>
> Wow.  That's a crazy amount of code for something so simple.
>
> Here's what I use:
>
> -------------------------------------------
> import mx.events.EventDispatcher;
>
> class net.stevensacks.utils.ObservableClip extends MovieClip
> {
>        public var addEventListener:Function;
>        public var removeEventListener:Function;
>        private var dispatchEvent:Function;
>
>        function ObservableClip()
>        {
>                EventDispatcher.initialize(this);
>        }
> }
> -------------------------------------------
>
> Just have your MovieClip classes extend ObservableClip instead of MovieClip
> and you can addEventListener and dispatchEvent simply and easily.
>
> :)
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to