Attaching movieclips inside movieclips

Author: seven October 4, 2006

I spent two days figuring out why I can’t attach movieclips inside movieclips in my current Flash 8 project. Results were pretty insane. Couldn’t find answer anywhere on the net, and as my last resort I went to Macromedia livedocs (livedocs). There I saw a post dating from mid 2005. Didn’t believe that solution will work on Flash 8, but hey – it does. :) (Happy! Happy!)
So, if you want to declare movieclip variable and attach movie clip at the same time, I would recommend using the following code:

var str:String = “identifier”;
tools.attachMovie(str,str,tools.getNextHighestDepth(),{_x: -50});
var mc:MovieClip = tools[str];

rather than:

var str:String = “identifier”;
var mc:MovieClip = tools.attachMovie(str,str,tools.getNextHighestDepth(),{_x: -50});

Author
seven
CEO/CTO at Nivas®
Neven Jacmenović has been passionately involved with computers since late 80s, the age of Atari and Commodore Amiga. As one of internet industry pioneers in Croatia, since 90s, he has been involved in making of many award winning, innovative and successful online projects. He is an experienced full stack web developer, analyst and system engineer. In his spare time, Neven is transforming retro-futuristic passion into various golang, Adobe Flash and JavaScript/WebGL projects.

    Leave a Reply

    Your email address will not be published. Required fields are marked *