enableMouseOver(); mouseEnabled = true;
在stage中的item若要mouse over能被偵測到,stage必需要enableMourseOver且mouseEnabled也要打開才行,預設下mouseEnabled是開啟,但enableMourseOver則否,要特別啟動它。所以code如下:
var stage = new createjs.Stage("text"); stage.mouseEnabled = true; stage.enableMouseOver(); var circle = new createjs.Shape(); circles.on("mouseover", function (evt) { var target = evt.target; //do something... }); stage.addChild(circles); stage.update();
更動滑鼠標示:
target.cursor = "pointer";
參考網址:
EASELJS MOUSE INTERACTION
Mouse event example
TweenLite-Example