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

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

Enthusiast ,
Jul 02, 2021 Jul 02, 2021

How to create a new movie clip using HTML5 code.

And add movie clips to the Stage.

I also need to name movie clips.

661
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 2 Correct answers

Community Expert , Jul 03, 2021 Jul 03, 2021

var mc = new createjs.MovieClip();

mc.name="mc_name";

this.addChild(mc);

 

Translate
LEGEND , Jul 03, 2021 Jul 03, 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 pr

...
Translate
Community Expert ,
Jul 03, 2021 Jul 03, 2021

var mc = new createjs.MovieClip();

mc.name="mc_name";

this.addChild(mc);

 

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
Enthusiast ,
Jul 03, 2021 Jul 03, 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());

 

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 ,
Jul 03, 2021 Jul 03, 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? 

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
Enthusiast ,
Jul 04, 2021 Jul 04, 2021

Thank you for your answer.

When I learn that I cannot use the instance name,

I will think about other ways.

Thank you again.

 

I want to create containers in bulk. Then batch control.

The container is part of the direct drawing, part of the code generation.

I want to do an array or object operation on a container.

What is loaded into the container is a different operation.

 

 

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
Community Expert ,
Jul 04, 2021 Jul 04, 2021
LATEST

you're welcome 

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
Community Expert ,
Jul 03, 2021 Jul 03, 2021

everything from the console.log and below is wrong and unrelated to anything suggested by me.

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
Enthusiast ,
Jul 04, 2021 Jul 04, 2021

Thank you for your answer.

It helped me a lot, thank you.

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