Walking animation

I posted this in “Flash CS4”, but then realized there’s a more specific board, which gets 6 times the views. Here we go again.

So, I’m trying to make a game, and I need a character to (animatedly) walk when you press the left and right keys. He walks, but the animation doesn’t work.
Essentially, I have a little stickman, in a movieclip. Frame one (“static”) is well, your general, standing stickman. No frame actionscript. Frame two (“right”) is the start of an animation, followed by frames 3-8, and frame 8 has

this.gotoAndPlay("right");

for actionscript. Frame nine, as you can probably imagine, is called “left”, is the start of the opposite animation, is followed by frames 10-15, and frame 15 has

this.gotoAndPlay("left");

for the actionscript.
The main timeline’s first frame’s actionscript is as follows:

//Main function...
mcMain.addEventListener(Event.ENTER_FRAME, mainFunc);
function mainFunc(event:Event):void {
    //if certain keys are down then move the character
    if(leftKeyDown){
        mcMain.x -= mainSpeed;
        //start ani
        this.mcMain.gotoAndPlay("left");
    } else {
        //end ani
        this.mcMain.gotoAndStop("static");
    }
    if(rightKeyDown){
        mcMain.x += mainSpeed;
        //start ani
        this.mcMain.gotoAndPlay("right");
    } else {
        //end ani
        this.mcMain.gotoAndStop("static");
    }
}

Instead of the desired effect (when right/left pressed, right/left animation, when nothing pressed, static), it just goes to (and stops) on the “right” (second) frame when right is pressed, and stays static when left is pressed, or nothing is pressed, or if right is let go of.

Sorry for the giant post, if I missed something, or something needs clarification, just post!

:luigi: