PDA

View Full Version : bitmap hitTest problem


Varangian
02-13-2008, 11:50 AM
Hi,

I am using flex actionScript. I hope it's the same as flash since I never actually made use of flash.

I am using bitmap.hitTest method to make pixel level detection. I have rotated rectangles and one of them is moving towards another. I have something like this.

ar shipBmpData:BitmapData = new BitmapData(shipBox.width,shipBox.height,false,0);
shipBmpData.draw(shipBox);
var hitImageBmpData:BitmapData = new BitmapData(shipBoxHit.width,shipBoxHit.height,fals e,0);
hitImageBmpData.draw(shipBoxHit);


if (hitImageBmpData.hitTest(new Point(shipBoxHit.x,shipBoxHit.y),255,shipBmpData,n ew Point(shipBox.x,shipBox.y),255))
{
Alert.show('final hit');
}

Basically getting the two objects bitmap data. This doesn't work. Why and what problems do I have? I cannot find any correct info on the internet.

Thanks in advance