Search code examples
actionscript-2flash-cs5

Changing animation on a movieclip on a key press is failing


I'm trying to make the animation change on a key press then loop to simulate running. But it sticks on the gotoAndPlay(9) trigger, regardless of what frame the animation is on.

onClipEvent(keyDown)
{
        if (Key.isDown(Key.RIGHT))
        {
            this._x += 5;

                if (this.currentFrame <= 9)
                {
                    if (this.currentFrame <= 8)
                    {

                    gotoAndPlay(9);
                    }
                    else
                    {
                        //nothing
                    }
                }
        }

Solution

  • If it's AS2 it should be:

    _currentframe
    

    instead of

    currentFrame
    

    But it could be something else, perhaps a stop() on frame 9?