给个属性比如
mc.proper="123"
然后在函数里面引用
mc.proper="123"
然后在函数里面引用
mc.proper="123"
mc.addEventListener(MouseEvent.MOUSE_UP,MoneyUpListener);
public function MoneyDownListener( event:MouseEvent): void {
event.target.startDrag();
trace( event.target.proper)
}
public function MoneyDownListener( event:MouseEvent): void {
event.target.startDrag();
trace( event.target.proper)
}
方法二:
var sayHello:String =
"欢迎光临";
btn1.addEventListener(MouseEvent.CLICK, function (e:MouseEvent){clickHandlerWithArg(e,sayHello)});
function clickHandlerWithArg(e:MouseEvent,arg:String): void
{
var out:String= e.target + "发出事件(有参数) :" + arg;
trace(out);
}
btn1.addEventListener(MouseEvent.CLICK, function (e:MouseEvent){clickHandlerWithArg(e,sayHello)});
function clickHandlerWithArg(e:MouseEvent,arg:String): void
{
var out:String= e.target + "发出事件(有参数) :" + arg;
trace(out);
}
转载于:https://blog.51cto.com/wqing/188936