[]Tween回调方法里如何带参数?

Tween.to(sp, {x:_x, y:_y, alpha:1}, 1000, null, Handler.create(This, function(){
    sp.destroy();
}), 500);
这样写sp并不能被销毁,请问laya里沒有onCompleteParams方法吗?

cuixueying

赞同来自:

测试没有问题,可以提供个例子我们看下
测试代码:
			var sp:Sprite=new Sprite();
sp.graphics.drawRect(0,0,100,100,"#FF0000");
Laya.stage.addChild(sp);
Tween.to(sp,{x:300,y:300,alpha:0.5},1000,null,Handler.create(this,function():void
{
sp.destroy();
}));

Complete事件你没写错,就是那么写的

111.png

 
 

ohkei - as3、as2、h5

赞同来自:

for (var i:int = 1; i <= 2;i++ ){
var sp:Sprite=new Sprite();
sp.graphics.drawRect(0,0,100,100,"#FF0000");
Laya.stage.addChild(sp);
Tween.to(sp,{x:300,y:300,alpha:0.5},1000,null,Handler.create(this,function():void
{
    sp.destroy();
}));
}
@cuixueying ,我刚刚试了一下写1个sp确实好用,但要是放到循环里就无法销毁每一个sp啦

要回复问题请先

商务合作
商务合作