Copy link to clipboard
Copied
I want to load a movieclip and preserve the layers
i load the movieclips with the code below on diffrent layers and i want that the movieclips executed from the code the i inserted on the lowest layer also stays on the lowest layer ?
var that = this;
that.addChild(new lib.Movieclip01());
Is this possible, how do i do that ?
Also you need to give a linkage name to your movie clip. In the example above it is NameofSymbol.
Here is an example I made to illustrate using symbols from library
add and swap symbols-2.zip - Box
Copy link to clipboard
Copied
the code you're showing doesn't load anything. it's creating an instance of Movieclip01.
the code you're showing doesn't add anything to a particular layer. it's adding (via addChild) the above instance to the top-most layer.
to do what you want, you can place a movieclip on the stage (on the layer/frame/position) where you want to add that instance, assign an instance name (eg, mc01_parent) and use:
this.mc01_parent.addChild(new lib.Movieclip01());
Copy link to clipboard
Copied
You can also add movieclips from the library to a blank movieclip if you want.
Here is an example:
this.stop(); // main timeline
var a= new lib.NameofSymbol(); // movie clip from the library
//************** LOAD BUTTON ACTIONS *************************
this.addBtn.addEventListener("click", loadSymbol.bind(this));
function loadSymbol(){
this.blank.addChild(a); // load a into blank movie clip
this.gotoAndPlay('start'); // main timeline
a.gotoAndPlay("aLabelName"); // address the symbol with the object name
}
Copy link to clipboard
Copied
Also you need to give a linkage name to your movie clip. In the example above it is NameofSymbol.
Here is an example I made to illustrate using symbols from library
add and swap symbols-2.zip - Box