How to use BitmapData’s hitTest to do pixel level hit detection against another bitmap.
class Actor extends Sprite {
public var someBitmap:Bitmap;
}
var src:Actor = new Actor();
var target:Actor = new Actor();
// bm is BitmapData.
var bm:BitmapData = obj.someBitmap.bitmapData;
// target is BitmapData
var bm2:BitmapData = target.someBitmap.bitmapData;
// this checks if src object collides with target object.
if (bm.hitTest(new Point(src.x, src.y), 255, bm2, new Point(target.x, target.y))) {
trace('hit!');
}