close


import flash.geom.Point;
import flash.display.BitmapData;
this.onEnterFrame = function():Void 
{


if (Box1.pixelHitTest(Box2))
{
//透明化
this.Box1._alpha = this.Box2._alpha = 10;
}
else if (Box1.pixelHitTest(Box3))
{
this.Box1._alpha = this.Box3._alpha = 10;
}
else
{
this.Box1._alpha = this.Box3._alpha = 100;
this.Box1._alpha = this.Box2._alpha = 100;
}


};


this.Box1.onPress = this.Box2.onPress = startDrag;
this.Box1.onRelease = this.Box2.onRelease = stopDrag;


MovieClip.prototype.pixelHitTest = function(mc:MovieClip):Boolean 
{
var thisBitmap:BitmapData = new BitmapData(this._width, this._height, true, 0);
thisBitmap.draw(this);


var mcBitmap:BitmapData = new BitmapData(mc._width, mc._height, true, 0);
mcBitmap.draw(mc);


if (thisBitmap.hitTest(new Point(this._x, this._y), 0xFF, mcBitmap, new Point(mc._x, mc._y)))
{
return true;
}
return false;
};

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 鴨鴨仔 的頭像
    鴨鴨仔

    DUCK,Fearless!

    鴨鴨仔 發表在 痞客邦 留言(0) 人氣()