加个引用
类似:

代码
var func:Function;
stage.addEventListener(MouseEvent.CLICK,func
=function(e){a(1)});
function a(b) {
        trace(b);
        stage.removeEventListener(MouseEvent.CLICK,func);
}


//或者

代码
stage.addEventListener(MouseEvent.CLICK,function(e:MouseEvent){a(e,arguments.callee,1,2,3)});
function a(e:MouseEvent,caller:Function,AS3事件加参数以及删除事件arg) {
        trace(arg);
        stage.removeEventListener(MouseEvent.CLICK,caller);
}


获取引用:
arg[0],arg[1],arg[2]

实例:

代码
var easing:Number = 0.05;
txt_mc.addEventListener(Event.ENTER_FRAME,function(e:Event){a(e,arguments.callee,
10)});


function a(e:Event,caller:Function,AS3事件加参数以及删除事件arg){
        var a:MovieClip
= e.target as MovieClip;
        
if(arg[0]-a.height<-1){
                a.height 
+=(arg[0]-a.height)*easing;
                trace(a.height);
        }
else{
                trace(
"结束")
                a.height 
=arg[0];
                a.removeEventListener(Event.ENTER_FRAME,caller);
        }
}

//

var easing:Number 
= 0.1;
var fun:Function 
= function(e:Event){Scrolling(e,80);};
txt_mc.addEventListener(Event.ENTER_FRAME,fun);

function Scrolling(e:Event,len:
int){
        var a:MovieClip
= e.target as MovieClip;
        
if(len-a.height<-0.5){
                a.height 
+=(len-a.height)*easing;
        }
else{
                trace(
"结束")
                a.height 
=len;
                a.removeEventListener(Event.ENTER_FRAME,fun);
        }
}

 

相关文章:

  • 2021-12-17
  • 2022-12-23
  • 2021-07-19
  • 2021-10-25
  • 2021-06-13
  • 2021-06-10
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-09-08
  • 2022-12-23
相关资源
相似解决方案