AS3: hitTestPoint

[ 2010-08-12 14:14:05 | Author: liuhuan ]
Font Size: Large | Medium | Small


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;
}
Comments Feed Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=1082

There is no comment on this article.

You can't post comment on this article.