2009年1月23号,离放假还有 4个小时,没事翻翻 BitmapData ,正在研究threshold 函数。
做了一好玩效果的swf,
。
祝新年快乐!!!,希望大家和我自己在新的一年万事顺利!!!!!
package {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import flash.events.*;
public class BitmapDataTest extends Sprite{
public function BitmapDataTest() {
var bitmap:Bitmap = new Bitmap(bitmapDataTemp);
addChild(bitmap);
bitmap.filters = [new DropShadowFilter(),
new GlowFilter()];
this.addEventListener(Event.ENTER_FRAME,handler);
}
private var i:uint=0;;
private function handler(e:Event):void {
bitmaptest();
}
private function framHandler(e:Event):void {
bitmaptest();
}
private var bitmapData2:BitmapData = BitmapData(new photo2(0,0));
private var bitmapDataTemp:BitmapData = new BitmapData(600,400,true,0);
private function bitmaptest():void {
bitmapDataTemp.lock();
bitmapDataTemp.threshold(bitmapData2,
bitmapData2.rect,
new Point(),
">",
getI(),
0,
0x000000FF,
true);
bitmapDataTemp.unlock();
i++;
}
private function getI():uint {
if(uint(i/0xFF)) {//1
return 0xFF*2 - i%0xFF;
}
else {//0
return i%0xFF;
}
}
}
}