Converting AS2 to AS3

Converting AS2 to AS3

Post by SymTs » Thu, 14 Jun 2007 07:05:35


I have a few custom classes that I built in AS2 that use
createEmptyMovieClip(). I'd like to mod these over to AS3 and as a result, I
need to find the way around the absence of createEmptyMovieClip since it was
removed in AS3. I noticed we did get a new MovieClip class. What I'm
wondering is (based on what I've read on the class), is if this code does the
same thing....

AS2
var _mc:MovieClip = _root.createEmptyMovieClip("my_mc");
var _mc2:MovieClip = _mc.createEmptyMovieClip("my_2mc");

AS3
var _mc:MovieClip = new MovieClip();
var _mc2:MovieClip = new MovieClip();
_mc.addChild(_mc2);
addChild(_mc);
 
 
 

Converting AS2 to AS3

Post by kgla » Thu, 14 Jun 2007 07:12:28

it does, IF the scope of your as3 code is the main timeline.

 
 
 

Converting AS2 to AS3

Post by SymTs » Thu, 14 Jun 2007 07:14:14

It is. Thanks again kglad. I appreciate it. Saving me precious brain cells :D
 
 
 

Converting AS2 to AS3

Post by kgla » Thu, 14 Jun 2007 07:59:13

you're welcome.

p.s. one difference is that you won't reference _mc._mc2 from that main
timeline. you'll just reference _mc2, even though it's a child of _mc. and
_mc2 can be a child of, at most, one movieclip.