Using hitTestPoint : Sprite : Development Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Development » Sprite »

 

Using hitTestPoint


 

package{
  import flash.display.*;
  import flash.geom.*;
  public class Main extends Sprite{
    public function Main(){

        var pt:Point = new Point(2030);
    
        var temp:Sprite = new Sprite();
        temp.graphics.beginFill(0x00ff001.0);
        temp.graphics.drawRect(003030);
        temp.graphics.endFill();
        addChild(temp);
    
        if (temp.hitTestPoint(pt.x, pt.y))
        {
            trace("Point within bounds");
        }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Development
» Sprite