/ Published in: ActionScript 3

Add content to stage from Library through code and use the content.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// METHOD 1 // Add Content var someMc:String = "this_mc"; var newClass = getDefinitionByName(someMc); var mcAdded= new newClass (); addChild(mcAdded); // Use Content var someString:String = "mcAdded"; var selectedInstance = getChildByName( someString); selectedInstance.x = 210; // METHOD 2 // In the MovieClip properties, set it to export for ActionScript and give it a class name. //In your code. var MC = new yourMCclassName();
Comments
