Highlighted

Duplicating a movie clip in animate by code

Community Beginner ,
Mar 24, 2020

Copy link to clipboard

Copied

Hi

How can I duplicate a movie clip in Animate using Javascript code?

Views

288

Likes

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

Duplicating a movie clip in animate by code

Community Beginner ,
Mar 24, 2020

Copy link to clipboard

Copied

Hi

How can I duplicate a movie clip in Animate using Javascript code?

Views

289

Likes

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
Mar 24, 2020 0
Adobe Community Professional ,
Mar 24, 2020

Copy link to clipboard

Copied

Hi.

 

If by duplicating you mean cloning - keeping all transformations and other changes applied to an instance - then no. Unfortunately it's not possible to clone Movie Clip instances in CreateJS as stated here.

 

But if what you want is to only add instances of a symbol at runtime as it is in the Library, you could code something like this:

 

 

 

var platform = new lib.Platform();
this.addChild(platform);

 

 

 

 

Please let us know if you have any further questions.

 

 

Regards,

JC

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

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
Reply
Loading...
Mar 24, 2020 1
Community Beginner ,
Mar 24, 2020

Copy link to clipboard

Copied

Thank you for your reply

It didn't work

The situation is that I have a movie clip called "spot" and I want to make several copies of it with the same propeties and I want to move each of them according to some conditions during interacting, so what is the best way to do this?

Likes

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
Reply
Loading...
Mar 24, 2020 0
Adobe Community Professional ,
Mar 24, 2020

Copy link to clipboard

Copied

You're welcome.

 

Then you're gonna have to add new instances as I mentioned above and then manually assign to the new instances the properties (x, y, rotation, alpha, currentFrame, and so on) values from the ones that are already on stage.

 

Alternatively, you may want to search over the Internet if someone created a class or method for CreateJS/EaselJS that can duplicate Movie Clip instances.

 

Or maybe someone else here has a better answer than mine.

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

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
Reply
Loading...
Mar 24, 2020 1
Adobe Community Professional ,
Mar 24, 2020

Copy link to clipboard

Copied

IIRC the new lib thing only works if you assign a linkage name in the library.

Likes

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
Reply
Loading...
Mar 24, 2020 2
Adobe Community Professional ,
Mar 24, 2020

Copy link to clipboard

Copied

Oh yeah. I forgot to mention that. Thanks, Clay!

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

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
Reply
Loading...
Mar 24, 2020 1
Community Beginner ,
Mar 24, 2020

Copy link to clipboard

Copied

And how to do that? I mean the linkage?

I was trying the addChild and the addChildAt method but didn't work so far

 

Likes

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
Reply
Loading...
Mar 24, 2020 0
Adobe Community Professional ,
Mar 24, 2020

Copy link to clipboard

Copied

In the Linkage column of the Library panel.

 

image.png

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

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
Reply
Loading...
Mar 24, 2020 1
Community Beginner ,
Mar 24, 2020

Copy link to clipboard

Copied

Thank you very much

It really worked!!

Likes

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
Reply
Loading...
Mar 24, 2020 1
Community Beginner ,
Mar 24, 2020

Copy link to clipboard

Copied

You've been a big help

Likes

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
Reply
Loading...
Mar 24, 2020 1
Adobe Community Professional ,
Mar 24, 2020

Copy link to clipboard

Copied

That's great!

 

You're welcome!

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

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
Reply
Loading...
Mar 24, 2020 0