AS3: hitTestPoint
[ 2010-08-12 14:14:05 | Author: liuhuan ]
A small example showing how hitTestPoint works in ActionScript 3.0.
var hitResult:Boolean;
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
function onEnterFrameHandler(e:Event) {
if (mLeft.hitTestPoint(mouseX, mouseY, true) ) {
hitResult = true;
} else if (mRight.hitTestPoint(mouseX, mouseY, false) ) {
hitResult = true;
} else {
hitResult = false;
}
txt.text = "hit: "+ hitResult;
}
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
function onEnterFrameHandler(e:Event) {
if (mLeft.hitTestPoint(mouseX, mouseY, true) ) {
hitResult = true;
} else if (mRight.hitTestPoint(mouseX, mouseY, false) ) {
hitResult = true;
} else {
hitResult = false;
}
txt.text = "hit: "+ hitResult;
}

There is no comment on this article.
You can't post comment on this article.