I need some help with a couple of lines of code on my current project.
function spoonf (e:Event):void{ spoon.buttonMode = false var spoontweengo:Tween = new Tween(spoon, "y", Regular.easeInOut, 280, 240, 20, false); spoontweengo.addEventListener(TweenEvent.MOTION_FINISH, aspoonf); function aspoonf (e:Event):void{ aspoon.alpha = 1; var aspoonTimer:Timer = new Timer(3000); aspoonTimer.addEventListener(TimerEvent.TIMER, aspoongo); aspoonTimer.start(); function aspoongo (e:Event):void{ aspoon.alpha = 0; var spoontween:Tween = new Tween(spoon, "y", Regular.easeInOut, 240, 280, 20, false); spoon.buttonMode = true spoon.useHandCursor = true } } }
The second tween on this, "spoontween", is looping for apparently no reason. I cannot work out why this is happening, or how to fix it, but I really need some help. Thanks.
Nevermind, I worked it out myself. If anyone had a similar problem and wanted to know the answer, it was to do with the timer. I had set the timer so it repeated every 3 seconds : var aspoonTimer:Timer = new Timer(3000); and so the lines of code triggered by the timer were also looped. To fix the problem I replaced "(3000)" with "(3000, 1)".