开发者

Problem in tween method AS3

From timerEvent I have called a function[say 'createBall'] ,passing a Variable[ballCount] every time . In that function[create ball] ,tween have been called and TweenComplete Listener also added . Yet times , the tween is not getting completed .Also it's not giving any error .

tweenX = new Tween(obj,"x",Regular.easeInOut,nX,this["tile" + String(bombHit_A[nBombCount] + 0)].x,2,true);
tweenY = new Tween(obj,"y",Regular.easeInOut,nY,this["tile" + String(bombHit_A[nBombCount] + 0)].y,2,true);
tweenX.addEventListener(TweenEvent.MOTION_FINISH, function (e:TweenEvent){hitCompleted(e,obj.name,"tile"开发者_如何学编程 + String(bombHit_A[nBombCount] + 0),nBombCount)});


Apparently, this is the same case as in this post: your tween instances get prematurely garbage-collected. Follow the link to know more.

EDIT Decided to add some hints right here. Where do you store those tweenX and tweenY variables? What is their scope? Are they declared in a method? If so, the references are disposed of once that method exits. You need to maintain a viable reference to tween objects for the whole time of their work, otherwise they may get garbage-collected in the process (but you can't know for sure whether this will happen or not).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜