Well usually it would just be:

class SomeClass 
{ 
    public function SomeClass( timeline:MovieClip )
    {
      ...
    }
}
...
var s:SomeClass = new SomeClass( MyCanvasMC );
...
and then you just act on the timeline var.

I usually create a static method that takes parameters
and passes them to the class as it keeps it nice and clean:

class SomeClass
{
   public static function createInstance( host:MovieClip, 
                                          name:String,
                                          depth:Number,
                                          a:Number, b:Object ) : SomeClass
   {
      var sc:SomeClass = host.attachMovie( "SomeClass", name, depth, { $a:
a, $b: b } );

      return sc; 
   } 
}
...
var sc:SomeClass = SomeClass.createInstance( this, "sc", 1, 120, obj );

Keeps all the crufty bits inside the class where it belongs.

~neo

 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jim Kremens
Sent: 29 June 2006 10:46 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Programmatically instantiating a class that
extendsMovieClip.

"Why not subclass object instead? Both ActionStep and ASwing work this way,
then create movieclips on the fly. It's very nice to work with."

So you never really subclass movieclip, you use composition instead.  In
other words, your class has a movieclip, but it isn't a movieclip.,,

Is that what you mean, or am I missing the point?  Can you give a small code
example?

Thanks,

Jim Kremens
_______________________________________________
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

Reply via email to