HTML5 canvas -Ticker question to execute functions eg: this.on("click", clickHandler, here, false);

Explorer ,
Feb 28, 2021 Feb 28, 2021

Copy link to clipboard

Copied

I keep seeing the Ticker being used to execute functions. I just wanted to clarify a few things.

It seems to be used when something is loading ie: check to see if the object is loaded then execute the function.

What's the difference between 

this.on("click", clickHandler, here, false);

AND

createjs.Ticker.on("tick", ckickHandler);

Also, in the old days, you had to use am add event listener to check if the stage was added, then execute the code. I think it was also a bad idea to put code on the first frame.

Do we need to add anything to our HTML5 canvas first frame?

 

Views

31

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
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Feb 28, 2021 Feb 28, 2021
thie "click" event occurs once each time the user clicks (mousedown and mouseup) something. the Ticker "tick" event executes repeatedly at the framerate of the project.  so, it's ideal to use for checking to see if something has occured yet, and if not, check again a fraction of a second later. typically, when that something has occured something is done AND the Ticker "tick" loop is terminated (with removeEventListener or the off method). generally, nothing needs to be added to a html5 fi...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 28, 2021 Feb 28, 2021

Copy link to clipboard

Copied

LATEST

thie "click" event occurs once each time the user clicks (mousedown and mouseup) something.

 

the Ticker "tick" event executes repeatedly at the framerate of the project.  so, it's ideal to use for checking to see if something has occured yet, and if not, check again a fraction of a second later.

 

typically, when that something has occured something is done AND the Ticker "tick" loop is terminated (with removeEventListener or the off method).

 

generally, nothing needs to be added to a html5 first frame but it would be unusual to put nothing in the first frame.

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
community guidelines