Sorry for my bad english,
Hello guys ^_^, I'm a newbie try to use createjs and Flash CC.
i'm creating an apps with the simple hitTest function in Flash CC (html5 Canvas), but looks like it seem not to work. There is two objects (a movieclip type object) on the canvas (and i put it on array called "arrTmbl"), when i try to mouseover on it, the console log always showing "Not Hit", here is my code:
var arrTmbl = ['tmbl0', 'tmbl1'];
var update = true;
stage.enableMouseOver(10);
stage.addEventListener("tick", f_tick);
function f_tick() {
if (update) {
update = false;
stage.update();
}
}
for (var i in arrTmbl) {
this[arrTmbl[i]].addEventListener("mouseover", function (e) {
var pt = e.currentTarget.globalToLocal(stage.mouseX, stage.mouseY);
if (e.currentTarget.hitTest(pt.x, pt.y)) {
console.log("Hit");
} else {
console.log("Not Hit");
}
});
this[arrTmbl[i]].addEventListener("pressmove", function (evt) {
evt.currentTarget.x = evt.stageX;
evt.currentTarget.y = evt.stageY;
update = true;
});
this[arrTmbl[i]].addEventListener("pressup", function (jvt) {
jvt.currentTarget.gotoAndPlay("hit");
});
}
Thanks for your helping,
this[arrTmbl[i]]is resolving properly. Here is a quick fiddle using an array of random squares instead. Requires EaselJS 0.8.0 due to the Graphics commands (color change) - jsfiddle.net/lannymcnie/1sL8o0gr - Lanny