Highlighted

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;

 

Adobe Community Professional
Correct answer by JoãoCésar | Adobe Community Professional

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
TOPICS
Ad development, Code, Other, Performance

Views

173

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

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;

 

Adobe Community Professional
Correct answer by JoãoCésar | Adobe Community Professional

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
TOPICS
Ad development, Code, Other, Performance

Views

174

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
Nov 23, 2019 0
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
__________________________________________
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...
Nov 23, 2019 0
Participant ,
Nov 30, 2019

Copy link to clipboard

Copied

Thanks JC.   I appreciate it!

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...
Nov 30, 2019 1
Adobe Community Professional ,
Nov 30, 2019

Copy link to clipboard

Copied

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