2011-07-22 42 views
0

從timerEvent我調用了一個函數[say'createBall'],每次傳遞一個Variable [ballCount]。 在該函數[創建球]中,補間已被調用,TweenComplete監聽器也被添加。 現在,補間還沒有完成,也沒有給出任何錯誤。補間法中的問題AS3

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)}); 

回答

1

顯然,這是相同的情況as in this post:您的補間實例過早垃圾收集。 Follow the link瞭解更多。

編輯決定在這裏添加一些提示。你在哪裏存儲那些tweenXtweenY變量?他們的範圍是什麼?他們在方法中聲明嗎?如果是這樣,那麼一旦該方法退出,參考就會被丟棄。您需要在整個工作時間內維護補間對象的可行參考,否則他們可能會在進程中獲取垃圾回收(但您無法確定是否會發生這種情況)。