过滤PNG透明区域的鼠标状态

把BitmapData封装一下,过滤一下当前点的颜色再抛出事件:

var color:uint = bitmapData.getPixel32(e.localX,e.localY);
 
	if(!isAlpha(color))
	{
		dispatchEvent(
		new 	MouseEvent(BMP_DOWN,e.bubbles,e.cancelable,e.localX,e.localY,
		e.relatedObject,e.ctrlKey,e.altKey,e.shiftKey,e.bubbles,e.delta));
	}
	protected function isAlpha(color:uint):Boolean
	{
		var alpha:Number = (color & 0xFF000000) >>> 24;
		return alpha <= 0;
	}


你可能感兴趣的:(过滤PNG透明区域的鼠标状态)