Posted By

heathbo on 10/06/10


Tagged


Versions (?)

Load content from library onto stage


 / Published in: ActionScript 3
 

Add content to stage from Library through code and use the content.

  1. // METHOD 1
  2. // Add Content
  3. var someMc:String = "this_mc";
  4. var newClass = getDefinitionByName(someMc);
  5. var mcAdded= new newClass ();
  6. addChild(mcAdded);
  7.  
  8.  
  9. // Use Content
  10. var someString:String = "mcAdded";
  11. var selectedInstance = getChildByName( someString);
  12.  
  13. selectedInstance.x = 210;
  14.  
  15. // METHOD 2
  16. // In the MovieClip properties, set it to export for ActionScript and give it a class name.
  17.  
  18. //In your code.
  19. var MC = new yourMCclassName();

Report this snippet  

You need to login to post a comment.