# Looping smoothly using Timer and array problem

**URL:** <https://forum.kirupa.com/t/looping-smoothly-using-timer-and-array-problem/283628>\
**Category:** flash\
**Created:** [March 9, 2009, 11:50am UTC](https://forum.kirupa.com/t/looping-smoothly-using-timer-and-array-problem/283628 "2009-03-09T11:50:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luka66\_6](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@luka66\_6](https://forum.kirupa.com/u/luka66_6)\
**Post date:** [March 9, 2009, 11:50am UTC](https://forum.kirupa.com/t/looping-smoothly-using-timer-and-array-problem/283628/1 "2009-03-09T11:50:50Z")

</div>

Hi  
I have a small problem. I am trying to create seemless loop using a timer and array. I have a problem as there is a delay after i reset my variable it looks like the timer takes twice the time ( it does not loop seemlesly) Can any of you tell me where is the error in my code please?

```auto
import fl.transitions.*;
import fl.transitions.easing.*;
//jack1.alpha = 0;
jackHolder.jack2.alpha = 0;
jackHolder.jack3.alpha = 0;
jackHolder.jack4.alpha = 0;
jackHolder.jack5.alpha = 0;
var u:Number = 0;
var jackArray:Array = new Array()
jackArray.push(jackHolder.jack1)
jackArray.push(jackHolder.jack2)
jackArray.push(jackHolder.jack3)
jackArray.push(jackHolder.jack4)
jackArray.push(jackHolder.jack5)
var timer:Timer = new Timer(2000)
timer.addEventListener(TimerEvent.TIMER, goPic)
timer.start();
function goPic(evt:TimerEvent):void
{  
 if(u < jackArray.length)
 {
  jackArray[u].alpha = 1;
  jackHolder.addChild(jackArray[u])
  var TMJack:TransitionManager = new TransitionManager(jackArray[u])
  TMJack.startTransition({type:Fade, direction:Transition.IN, duration:2, easing:Regular.easeOut})
  TMJack.startTransition({type:PixelDissolve, direction:Transition.IN, duration:2, easing:Regular.easeOut, xSections:50, ySections:50})
 }
 if(u == jackArray.length)
 {
  u = -1;
 }
 u++; trace(u)
}

```

tnx
