views:

11

answers:

0

Hi All,

My code is doing what it is meant to be doing but somewhere along the line I am missing something in my logic.

I have three movie clips. Each one of them have two frames. The first one has nothing on it (so it looks hidden) and the second frame has the animation on it.

Using an array and the onEnterFrame function, I need to loop through these animations so that it looks like they are looping continuously but when it returns to the first MC, I get the blank.

var count = 0;
var currTank:Number = 0;
var prevTank:Number;
var speed:Number = 150;
var firstRun = true;


stg.onEnterFrame = function ()

{
count ++;

if (count >= speed)
{


    trace("");
    trace("currTank : " + currTank);
    prevTank = currTank;
    trace("prevTank : " + prevTank);
    currTank ++;
    trace("currTank ++ : " + currTank);
    trace("");
    tankAnims[prevTank].tank.gotoAndStop(1);
    tankAnims[currTank].tank.gotoAndStop(2);

    if (currTank == 0)
    {
        tankAnims[0].tank.gotoAndStop(2);
    }


    count = 0;
    firstRun = false;
};

if (currTank == tankAnims.length)
{
    currTank = 0;
}

}

tankAnims[currTank].tank.gotoAndStop(2);