[mtasc] Trying to use attachMovie and MovieClip subclasses wi thoutusing Flash MX

Dan Shryock dan.shryock at gmail.com
Thu Feb 10 20:29:13 CET 2005


Hi Chris,

Thanks for the great idea, I was able to get it working based on the
article you sent.  The only thing that needs to be done differently is
to add the -separate flag to the compile options in mtasc.  Below is a
completely working version.

class TestClip extends MovieClip{
	static var SymbolName:String				= "__Packages.TestClip";
	static var SymbolOwner:Object				= TestClip;
	static var SymbolLinked						= Object.registerClass(SymbolName,SymbolOwner);

	static function main() {
		_root.attachMovie(TestClip.SymbolName,"TestInstance",0);
	}

	public function TestClip(){
	}
}

Dan

On Wed, 9 Feb 2005 18:46:24 -0500, Allen, Christopher S.
<CSALLEN at partners.org> wrote:
> Hi Dan and others,
> 
> Peter Hall had suggested this way to accomplish what you are trying to do on his
> blog:
> 
> http://www.peterjoel.com/blog/?archive=2004_01_01_archive.xml
> 
> It works with the MMC, but I haven't tried it with MTASC; it might work though,
> and I'm sure that Nicolas can verify whether it will.
> 
> I hope that helps.
> -Chris
> 
> -----Original Message-----
> From: mtasc-bounces at lists.motion-twin.com
> [mailto:mtasc-bounces at lists.motion-twin.com] On Behalf Of Martin Schnabel
> Sent: Wednesday, February 09, 2005 4:29 PM
> To: MotionTwin ActionScript2 Compiler List
> Subject: Re: [mtasc] Trying to use attachMovie and MovieClip subclasses
> withoutusing Flash MX
> 
> But u can use an other approach:
>     You can encapsulate the Movieclip. That way u only need the graphics
> or animations, but u can load them at runtime.
> 
> class org.my.package.BaseSymbol{
>     private _mc:MovieClip;
> 
>     public BaseSymbol(parent:MovieClip,depth:Number){//or fully OO with
> parent:BaseSymbol
>             //there is also a movieclip method called getHigherDepth or
> s.th.
>             _mc = parent.createEmptyMovieClip("name",depth);
>     }
>     public getMovieClip():MovieClip{
>           return _mc;
>     }
> }
> 
> So this is a very simple example. but if u think further u can imagine
> how well u can extend this idea without loosing the possibilities of
> MovieClip.
> i prefer to use my own methods an work with the encapsulated MovieClip
> only internal.
> no guarantee that the code works.
> --
> Best Regards
>     mb0 - Martin Schnabel - mailto:mb0 at mb0.org
> 
> --
> MTASC : no more coffee break while compiling
> --
> MTASC : no more coffee break while compiling
>



More information about the mtasc mailing list