how to add a MovieClip from the library by a class i've MovieClip and i want to add it to the stage by a class
note i've already a class and linked to a MovieClip and what i woona do is to addChild another MovieClip in the stage
how to add a MovieClip from the library by a class i've MovieClip and i want to add it to the stage by a class
note i've already a class and linked to a MovieClip and what i woona do is to addChild another MovieClip in the stage
In the Library, you need to set your object Linkage Properties so that Export for Actionscript is checked and your library object has a class name. Then you should be able to call that class name in your code to add the library object to the stage
http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b8ea63-7fee.html
Is this what you're after? basically two objects in the library and one of them adding the second as a child
var mc1:MovieClip = new MyClass(); var mc2:MovieClip = new MyClass2(); mc1.addChild( mc2 ); addChild(mc1);
In the Library, right click on MovieClip, select Properties. In symbol Properties dialog: Check Export for ActionScript, and name it in the Class textbox. You can now treat it as regular ActionScript Class.
Let's say you named it: 'libraryMC'.
Instantiate Class and add it to the stage.
var myClip:libraryMC = new libraryMC(); // MovieClip instantiation
addChild(myClip); //actually adding instantiated MovieClip on the stage
package { import flash.display.Sprite;
public class FirstMOvieClip extends MovieClip {
public function FirstMOvieClip () {
addChild (new SecondMovieClip())
// This will add second MovieClip to first MovieClip
}
}
You can not add second movie-clip to stage unless first movie-clip is added to stage. This is what i think, you were asking.