A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: BitmapData.hitTest() how accurate?

Threaded View

  1. #1
    Senior Member
    Join Date
    May 2006
    Posts
    145

    BitmapData.hitTest() how accurate?

    I am using BitmapData.hitTest() and want to know why it is not accurate.
    and the next question will be, how to make it accurate.

    Code:
    public static function pixelHitTest(mc1:MovieClip,mc2:MovieClip):Boolean {
    			var mc1bd:BitmapData = new BitmapData(mc1.width, mc1.height, true, 0);
    			mc1bd.draw(mc1);
    			var mc2bd:BitmapData = new BitmapData(mc2.width, mc2.height, true, 0);
    			mc2bd.draw(mc2);
    			if (mc1bd.hitTest(new Point(mc1.x, mc1.y), 0xFF, mc2bd, new Point(mc2.x, mc2.y))) {
    				return true;
    			} else {
    				return false;
    			}
    		}
    here is the link to show that it is not accurate.
    http://www.geocities.com/arian_m3/bitmaphittest.swf

    thank you in advance
    Last edited by ArielGenesis; 09-06-2007 at 01:46 AM.

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