« FlashDevelop ROCKS! | ^ Main | New Category: Authorize.net CFC »
ActionScript 3 Tip: Dynamic attachMovie
attachMovie is gone. In AS3 you simply say new Whatever() and it creates a new instance. I posted a brief tutorial on gotoAndStop.org. What I ran into today was trying to get this to work in the instance of a dynamic clip.
In AS2, this was common practice:
var linkage:String = “Blah”;
attachMovie(linkage, “new name”, 0);
In AS3, here is how you do it:
var linkage:String = “Box”;
var DynamicClass:Class = getDefinitionByName(linkage) as Class;
addChild(new DynamicClass());
This realllllly made my day. :-D I figured I’d go ahead and post it here so others can join in on the love.
BTW, still loving FlashDevelop. ;-)
Posted by John C. Bland II on June 22, 2007 12:33 PM | Permalink
TrackBack
TrackBack URL for this entry:
http://mt.katapultmedia.com/mt-tb.cgi/274



