javascript - EaselJS tick event delta property not propagating to children -


i starting out easeljs , running first hurdle. have extended container object create new class called egg:

(function() {  var egg = function(color, x, y, cy) {   this.initialize(color, x, y, cy); } var e = egg.prototype = new createjs.container(); // inherit container  e.container_initialize = e.initialize; e.initialize = function(color, x, y, cy) {    this.container_initialize();    this.circle = new createjs.shape();   this.circle.graphics.beginfill(color).drawcircle(0, 0, 10);   this.circle.x = x;   this.circle.y = y;   this.addchild(this.circle);    this.changey = cy;    this.addeventlistener("tick", this.handletick);  }  e.handletick = function(event) {   console.log(event.delta); // undefined! }  window.egg = egg;  }()); 

and initializing this:

var stage, timecircle;  function init() {    stage = new createjs.stage("gamecanvas");    timecircle = new createjs.shape();    createjs.ticker.useraf = true;   createjs.ticker.setfps(30);   createjs.ticker.addeventlistener("tick", tick);    var egg = new egg("red", 50, 50, 100);   stage.addchild(egg);    var egg2 = new egg("blue", 100, 50, 50);   stage.addchild(egg2);  }   function tick(event) {   stage.update(event); } 

in egg handletick function, when log out event.delta property, "undefined". thought if passed in event through stage.update call propagate objects on stage?

the ticker's tick-event little different displayobject's(or stage's) tick-event. see here: http://www.createjs.com/docs/easeljs/classes/displayobject.html#event_tick

so in case should work:

e.handletick = function(event) {     console.log(event.params[0].delta);     //params parameter use in stage.update(p1, p2, ...); } 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -