This AS2 class acts like the document class in AS3.

You need to extend MovieClip like you need to extend Sprite or MovieClip
in AS3.

Tracing this in the class will result in _level0, its not composition.
Its really useful for swf that you load, gives you the ability to type
check everything on the root timeline without having to create an empty
clip on the timeline etc... And I've thrown in EventDispatcher in there
which is really useful as well.


BLITZ | Patrick Matte - 310-551-0200 x214

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David
Ngo
Sent: Tuesday, April 24, 2007 9:01 PM
To: [email protected]
Subject: RE: [Flashcoders] Class for movie - best practice question

Why would you extend MovieClip and composition a MovieClip as well?
Seems a
bit redundant, no?


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Patrick
Matte | BLITZ
Sent: Tuesday, April 24, 2007 7:09 PM
To: [email protected]
Subject: RE: [Flashcoders] Class for movie - best practice question

Try this class. Put new ApplicationClass(this); on the first frame of
the timeline.

import mx.events.EventDispatcher;

class ApplicationClass extends MovieClip{
        
        public var addEventListener:Function;
        public var removeEventListener:Function;
        private var dispatchEvent:Function;

        public function ApplicationClass(target){
                target.__proto__ = __proto__;
                this = ApplicationClass(target);
                EventDispatcher.initialize(this);
                init();
        }

        private function init(){
                trace("this = " + this);
        }
        
}

You can also use that class as a generic class for all your timelines
and extend it like this

import mx.utils.Delegate;
import it.sephiroth.XML2Object;

class RootClass extends ApplicationClass{
        

        public function RootClass(target){
                super(target);
        }
        
        private function init(){
                trace("override init this = " + this);
        }
        
}
_______________________________________________
[email protected]
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

_______________________________________________
[email protected]
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
_______________________________________________
[email protected]
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

Reply via email to