My preference is actually:
 e) Don't extend Movie Clip.
:)

Basically, I prefer to have a class encapsulate a movie clip.  Either
have the constructor take a reference to an empty movie clip for it to
use as its UI area, or have it take in a reference to the MC that
should be its parent and have it create its own empty movie clip.

The reason I like this is that when you're extending a movie clip a
lot of times you may want to restrict some of the interaction with it
(to keep internal state valid, etc).  You don't necessarily want
someone (or even you, accidentally) playing with the MC itself, but
have your class completely manage it.  By encapsulating it inside
another class instead of simply extending it I feel it's a bit
cleaner.

But that's just me, and some claim I'm crazy. :)

  -Andy

On 1/17/07, Matthias Dittgen <[EMAIL PROTECTED]> wrote:
Hello,

beside the many AS3 questions, IMHO most of the current real-world
projects are still based on FlashPlayer 7 and 8 and thus on AS2,
because of the player penetration.
This was probably asked before, but I want to know which workflow
works best for you guys:

Do you prefer
a) the attachMovie method
b) the use of a static create method
c) a GUI toolkit like ASWING and extend from JComponent
d) some other workflow

Here's a class to illustrate (a) and (b):

/**
 * SomeMovieClip
 */
import net.lizu.*

class net.lizu.SomeMovieClip extends MovieClip
{
        // register class
        public static var SymbolName:String = 
"__Packages.net.lizu.SomeMovieClip";
        public static var SymbolOwner:Function = SomeMovieClip;
        public static var SymbolLinked = 
Object.registerClass(SymbolName,SymbolOwner);

        public var _some:String;

        // constructor
        public function SomeMovieClip()
    {
    }

        // alternative to attachMovie call
        public static function create(target:MovieClip, name:String,
initObject:Object):SomeMovieClip
        {
                return 
SomeMovieClip(target.attachMovie(SomeMovieClip.SymbolName,
name, target.getNextHighestDepth(), initObject));
        }

        // entrypoint
        static function main()
        {
                
_root.attachMovie(SomeMovieClip.SymbolName,"clipId1",_root.getNextHighestDepth(),
{_x: 30, _some: "Hello 1"});
                SomeMovieClip.create(_root, "clipId2", {_x: 30, _some: "Hello 
2"});
        }

}

And is there a way to automate the writing of SymbolName,SymbolLinked
and create for all my classes which extend MovieClip?

Thanks,
Matthias
_______________________________________________
[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