Skip to main content
karimn74647191
Participant
August 22, 2018
Answered

load movieclip and preserve layers in HTML5/Canvas

  • August 22, 2018
  • 2 replies
  • 766 views

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 ?

    This topic has been closed for replies.
    Correct answer avid_body16B8

    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

     

    2 replies

    avid_body16B8
    Legend
    August 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

       

    }

    avid_body16B8
    avid_body16B8Correct answer
    Legend
    August 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

     

    kglad
    Community Expert
    Community Expert
    August 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());