How to handle mouseover event in EaselJS? -
i'm using easeljs , i'd change (slightly enlarge) images while mouse hovering on them. seems mouseover , mouseout events way it.
http://www.createjs.com/docs/easeljs/classes/container.html#event_mouseover
however, there no examples in docs, or @ least couldn't find any. tried googling without luck.
i tried this:
stage.enablemouseover(); var btn = new createjs.bitmap("mybtn.png"); btn.mouseover = function() { btn.x++; };
and found out works:
btn.onmouseover = function() { btn.x++; };
but docs variant deprecated , 1 should use events. what's proper way?
you should use addeventlistener
shown in example (every time move mouse on circle, alpha/transparency changes):
http://jsfiddle.net/wiredprairie/u3pyd/
circle.addeventlistener("mouseover", function() { circle.alpha *= .80; stage.update(); });
it assumes you've called enablemouseover documented well:
stage.enablemouseover(20);
Comments
Post a Comment