How to replace the code for stage.addChild(exportRoot) for the latest Animate v20

Participant ,
Nov 23, 2019

Copy link to clipboard

Copied

For smoother html canvas playback, I used to replace this published code:

fnStartAnimation = function() {
		stage.addChild(exportRoot);
		createjs.Ticker.setFPS(lib.properties.fps);
		createjs.Ticker.addEventListener("tick", stage);
	}	

with this code:

fnStartAnimation = function() {
		stage.addChild(exportRoot);
		createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED;
		createjs.Ticker.setFPS(lib.properties.fps);
		createjs.Ticker.addEventListener("tick", stage);
}	

But with this new update the code looks like this:

 

fnStartAnimation = function() {
		stage.addChild(exportRoot);
		createjs.Ticker.framerate = lib.properties.fps;
		createjs.Ticker.addEventListener("tick", stage);
	}	  

 What's the correct way to add this line of code back into it without screwing anything up?

createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED;

 

TOPICS
Ad development, Code, Other, Performance

Views

268

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

1 Correct Answer

Adobe Community Professional , Nov 23, 2019
JoãoCésar Adobe Community Professional , Nov 23, 2019
Hi.   The timingMode from the Ticker class is a static property which means its associated to the class itself not to an instance of the class.   So it doesn't matter from where you change it.   With that being sad, you can add the code to the first frame of the main timeline, for example, and everything should work as expected.   Please let us know.     Regards, JC

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
Nov 23, 2019

Copy link to clipboard

Copied

Hi.

 

The timingMode from the Ticker class is a static property which means its associated to the class itself not to an instance of the class.

 

So it doesn't matter from where you change it.

 

With that being sad, you can add the code to the first frame of the main timeline, for example, and everything should work as expected.

 
Please let us know.
 
 
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
Participant ,
Nov 30, 2019

Copy link to clipboard

Copied

Thanks JC.   I appreciate it!

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 ,
Nov 30, 2019

Copy link to clipboard

Copied

You're welcome!

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