Create Movie Clip objects dynamically and add them to the Stage with javascript in HTML5 in Animate

New Here ,
Jun 16, 2020

Copy link to clipboard

Copied

Basically I want to instantiate MovieClip objects and add them to the Stage using Javascript(createjs) from the Actions panel in an HTML5 Adobe Animate project. I think previously this could be accomplished by giving a linkage identifier to the MovieClip in the library and instantiating the MovieClip using that but I don't see that option now. What is the best way to do this in an HTML5 project? 

TOPICS
Code, How to, Other

Views

164

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jun 16, 2020

Copy link to clipboard

Copied

Hi.

 

In HTML5 Canvas documents, you must assign a linkage name in the Linkage column in the Library.

JoãoCésar_0-1592333573826.png

 

Any symbol in the Library is a property from the global lib object that is automatically created by Animate when the content is published. To instantiate a symbol at runtime, you must use the linkage name as the constructor method name. Like this:

var platform = new lib.Platform();
platform.x = canvas.width * 0.5;
platform.y = canvas.height * 0.5;
this.addChild(platform);

 

I hope this helps.

 

Regards,

JC

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more