import flash.filters.BlurFilter; //导入模糊滤镜类 使用哪个滤镜事先就要导入哪个滤镜的类
this.attachMovie("logo","logo",1); //从库中把logo MovieClip拿出
logo._x=480;
logo._y=5;
var myBlurdata:BlurFilter=new BlurFilter(0,0,1); //定义一个模糊滤镜对象BlurFilter([blurX:Number], [blurY:Number], [quality:Number])
var myFilters:Array = logo.filters; //将logo.filters数组的值分配给临时数组myFilters
myFilters.push(myBlurdata); //将myBlurdata的值存放到myFilters数组中
this.onEnterFrame=function(){ //开始让logo运动
var tmpx=logo._x;
logo._x=tmpx-tmpx*0.2; //让logo做一个缓冲运动
myFilters[0].blurX=tmpx*0.2; //设置myFilters数组的值,注意myFilters[0],这里是表示myFilters.push(myBlurdata)的那次操作,如果又给他附加第二个滤镜对象的话,可以通过myFilters[1]来访问,以此类推。
logo.filters=myFilters; //将myFilters数组的值分配给logo.filters,相当于给logo施加了滤镜效果
if(tmpx<0.1){ //当离目的坐标非常近的时候停止运动
delete this.onEnterFrame;
}
}