[mtasc] _level0 ?

Darron J. Schall darron at darronschall.com
Wed Mar 9 13:50:26 CET 2005


Diego Brouard wrote:

> You don't need "_levelX" to refer to that movie, you already have a 
> reference to it: an empty movie clip where you have loaded the 
> external swf.

*ahem*  Yes you do - when you use loadMovieNum you load the .swf into a 
level, not into a container .swf.  The only way to refer to the loaded 
movie then is through it's level reference.  loadMovieNum and loadMovie 
are fundamentally different.

> In my opinion the "_levelX" syntax is very problematic because of  the 
> use of absolute paths to objects. I prefer use references to objects 
> or relative paths as "_parent" or "this". My programs are modules so 
> that absolute path cannot be used at any time: what is _level0 today, 
> tomorrow will be _level1 or _level2. "_level0" remembers me the "GO 
> TO" basic syntax.

You must use _level when dealing with loadMovieNum.  You can't _parent 
your way out of it.  Again, loadMovie is fundamentally different and you 
can get away without relative paths.

Typically, when dealing with levels I'll create a Singleton manager and 
refer to the movie by name.  Something like:

SwfManager.getInstance().getClip[SwfManager.PRELOADER_SCREEN]

... which would return, say _level15 if that's the level the particular 
.swf was loaded on.  You can code it in such a way to avoid all hard 
coded references except in one place, which makes maintenance just as 
easy since the SwfManager guy is in charge of loading into levels anyway. 

It's not as taboo as everyone makes it out to be.  ;-)

-d




More information about the mtasc mailing list