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

load movieclip and preserve layers in HTML5/Canvas

Community Beginner ,
Aug 22, 2018 Aug 22, 2018

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 ?

Views

635

Translate

Translate

Report

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

 

Votes

Translate

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

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

Votes

Translate

Translate

Report

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

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

   

}

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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