A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: cant detect hittestpoint

  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    122

    cant detect hittestpoint

    I am trying to detect if a point on an image is on the opaque part of the image or the transparent part.

    I have a image in a 48X48 area. half the image has transparent pixels.

    I seem to detect a hit on every part of the image like a bounding box test but i dont want that .



    for example . I place a 48X48 size image on stage at 0,0.
    At point 40,20 on the stage the image has transparent pixels but I get it detects a hit?


    mm.img.hitTestPoint(40,20,true); //it should give me false

    how can i solve this.

  2. #2
    Senior Member
    Join Date
    Aug 2006
    Posts
    122
    ok this tests if an image has a transparent pixel at 28,24 from the top left corner of the image and the image could be anywhere on screen.

    is this correct?

    the first paramter new Point(0,0) means from the 0,0 of the image and not on the stage?

    0 means test alpha chars

    p1 is the point to test


    'adobe docs are not clear for me'


    p1=new Point(28,24);
    myText.text="hitestpt(28,24) ="+ mm.img.bitmapData.hitTest(new Point(0,0),0,(p1)); // this works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center