Skip to content

Instantly share code, notes, and snippets.

@etrepum
Created April 23, 2009 01:23
Show Gist options
  • Save etrepum/100213 to your computer and use it in GitHub Desktop.
Save etrepum/100213 to your computer and use it in GitHub Desktop.
if (_level0 === undefined) {
/* detect AS3 container and patch MovieClip.hitTest */
var realRootForReal = this;
MovieClip.prototype.oldHitTest = MovieClip.prototype.hitTest;
MovieClip.prototype.hitTest = function (x, y, shapeflag) {
if (arguments.length === 1) return this.oldHitTest(x);
var obj = {x: x, y: y};
realRootForReal.localToGlobal(obj);
return this.oldHitTest(obj.x, obj.y, shapeflag);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment