I found this post on the Actionscript.org forums about TweenEvent dispatches not happening consistently.
I’ve come up against a similar problem in the past. The first thing to check is that the Tween instance does not go out of scope. For example (this is pseudo code)…
ActionScript Code:
private function doTween():void {
var tween:Tween = new Tween(....);
tween.addEventListener(TweenEvent.MOTION_FINISH, onFinished);
}
… will not work reliably - the tween instance goes out of scope when the function finishes (despite having an event listener attached to it) and I’ve found this unreliable. I make sure that the tween instance is always in scope:
ActionScript Code:
private var tween:Tween;
private function doTween():void {
tween.addEventListener(TweenEvent.MOTION_FINISH, onFinished);
}
My question is this - where do I call this part
var tween:Tween = new Tween(....);
is this what I’m meant to do:
ActionScript Code:
private var tween:Tween;
private function doTween():void {
var tween:Tween = new Tween(....);
tween.addEventListener(TweenEvent.MOTION_FINISH, onFinished);
}
As this doesn’t seem to make any difference. Thanks