Skip to main content
chenjil43641795
Legend
July 2, 2021
Answered

How to use HTML5 to create an empty movie clip and add it to the stage

  • July 2, 2021
  • 1 reply
  • 737 views

How to create a new movie clip using HTML5 code.

And add movie clips to the Stage.

I also need to name movie clips.

    This topic has been closed for replies.
    Correct answer Colin Holgate

    I don't think you can access a movieclip using a property value that you have set. And Animated_Container is a variable that belongs in the current context, exportRoot doesn't know about that variable either.

    If you need everything to be global, you could do this:

    exportRoot.Animated_Container = new createjs.MovieClip();
    exportRoot.Animated_Container.name = "Co_name";
    exportRoot.addChild(exportRoot.Animated_Container);
    exportRoot.Animated_Container.addChild(new createjs.MovieClip());

    The name property won't be needed.

    What's the reason you need to involve exportRoot? 

    1 reply

    kglad
    Community Expert
    Community Expert
    July 3, 2021

    var mc = new createjs.MovieClip();

    mc.name="mc_name";

    this.addChild(mc);

     

    chenjil43641795
    Legend
    July 3, 2021

    Thank you for your reply.

    I use that name.(exportRoot.this name)

    But the name is  undefined

     

    var Animated_Container = new createjs.MovieClip();
    Animated_Container.name="Co_name";
    exportRoot.addChild(Animated_Container);


    console.log(exportRoot.Co_name) 
    exportRoot.Co_name.addChild(new lib.child_mc1());

     

    Colin Holgate
    Colin HolgateCorrect answer
    Inspiring
    July 4, 2021

    I don't think you can access a movieclip using a property value that you have set. And Animated_Container is a variable that belongs in the current context, exportRoot doesn't know about that variable either.

    If you need everything to be global, you could do this:

    exportRoot.Animated_Container = new createjs.MovieClip();
    exportRoot.Animated_Container.name = "Co_name";
    exportRoot.addChild(exportRoot.Animated_Container);
    exportRoot.Animated_Container.addChild(new createjs.MovieClip());

    The name property won't be needed.

    What's the reason you need to involve exportRoot?