先看看效果:
原理:
1、获取整个舞台的BitmapData数据,放到__bm(声明的 BitmapData())里。
2、对__bm进行 BlurFilter 和 ColorMatrixFilter(可选 只是处理颜色) 处理。
3、在enterframe事件里 不断的重复步骤1,2。
//======================== code ========================
package{
import
flash.display.*;
import flash.ui.Mouse;
import flash.events.*;
import flash.filters.* ;
import flash.geom.*;
public class main extends Sprite{
private var __bmd:BitmapData;
private var __bm:Bitmap;
private var __bf:BlurFilter;
private var __asfox_mc:MovieClip;
private var __cmf:ColorMatrixFilter;
public function main(){
__init();
__initEvt();
}
private function __init():void{
stage.frameRate = 35;
Mouse.hide();
__bmd= new BitmapData(550,400,true,0x000000)
__bm=new Bitmap(__bmd);
addChild(__bm);
__bf=new BlurFilter(7,10,3)
__asfox_mc=new asfox();
__asfox_mc.scaleX =0.4
__asfox_mc.scaleY =0.4
addChild(__asfox_mc);
__cmf=new ColorMatrixFilter([1,0,0,0,0,
0,1,0,0,0,
0,0,1,0,0,
0,0,0,0.8,0]);
}
private function __initEvt():void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, __onMouseMove);
addEventListener(Event.ENTER_FRAME, __loop);
}
private function __loop(evt:Event):void{
__bmd.draw(this);
__bmd.applyFilter(__bmd,__bmd.rect,new Point(0,0),__bf);
__bmd.applyFilter(__bmd,__bmd.rect,new Point(0,0),__cmf);
__bmd.scroll(0,-6);
}
private function __onMouseMove(evt:MouseEvent):void{
__asfox_mc.x=evt.stageX
__asfox_mc.y=evt.stageY
}
}
}