3

This was the standard boiler plate I was using:

var stage = new createjs.Stage("canvas1");
createjs.Ticker.addEventListener("tick",stage);
stage.enableMouseOver();
...
createjs.Ticker.setFPS(12);
createjs.Ticker.addListener(stage,false);

Apparently createjs.Ticker.addListener is no longer supported. How should the above code be changed?

Bob H
  • 135
  • 8
  • Not sure what you are asking. The first usage is correct `createjs.Ticker.addEventListener("tick",stage);`. – Lanny Apr 19 '16 at 22:43
  • createjs.Ticker.addListener(stage,false); -- is no longer supported – Bob H Apr 19 '16 at 23:05
  • examples: https://gist.github.com/im007boy/3959027 and http://jsfiddle.net/lannymcnie/Aprdf/ – Bob H Apr 19 '16 at 23:20

1 Answers1

3

Your example shows both the correct and deprecated usage.

// OLD
createjs.Ticker.addListener(stage,false);

// NEW
createjs.Ticker.addEventListener("tick", stage);
//OR
createjs.Ticker.on("tick", stage);

The changes make Ticker use the same Event dispatcher pattern that the rest of CreateJS does.

Additionally, the framerate method has changed to a setter:

// OLD
createjs.Ticker.setFPS(12);

// NEW
createjs.Ticker.framerate = 12; 

It will depend on what version you use of EaselJS. I updated the demo you posted to the latest version using those changes: http://jsfiddle.net/lannymcnie/Aprdf/80/

Unfortunately there are still demos out there with out-of-date code. Let me know if you have any other questions.

Lanny
  • 11,244
  • 1
  • 22
  • 30