Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

load movieclip and preserve layers in HTML5/Canvas

Community Beginner ,
Aug 22, 2018 Aug 22, 2018

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 ?

705
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Aug 22, 2018 Aug 22, 2018

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

 

Translate
Community Expert ,
Aug 22, 2018 Aug 22, 2018

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());

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 22, 2018 Aug 22, 2018

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

   

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 22, 2018 Aug 22, 2018
LATEST

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines