ArielGenesis
09-06-2007, 01:42 AM
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.
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
and the next question will be, how to make it accurate.
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