Using hitTestPoint
package{
import flash.display.*;
import flash.geom.*;
public class Main extends Sprite{
public function Main(){
var pt:Point = new Point(20, 30);
var temp:Sprite = new Sprite();
temp.graphics.beginFill(0x00ff00, 1.0);
temp.graphics.drawRect(0, 0, 30, 30);
temp.graphics.endFill();
addChild(temp);
if (temp.hitTestPoint(pt.x, pt.y))
{
trace("Point within bounds");
}
}
}
}
Related examples in the same category