Help? Error 1078 - movieclip and keyboard listener
I'm having what's probably a very basic problem, but I keep getting this error message: Error 1079: Label must be a simple identifier. I'm trying to have AS navigate through a panorama I made in photoshop and turned into a movieclip (panorama_mc). I want it to move from end to end (registration point is in the center) without going past the end of the photo on either side. I also want to make sure that when you get to the end, you can navigate back in the other direction.
Here is my code:
panorama_mc.x = 0;
//moves panorama back and forth
stage.addEventListener(KeyboardEvent.KEY_DOWN, rightKeyPressed);
function rightKeyPressed(event:KeyboardEvent):void
{if (panorama_mc.x<=4361 && panorama_mc.x>-4361)
{Keyboard.RIGHT:panorama_mc.x -= 20;}
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, leftKeyPressed);
function leftKeyPressed(event:KeyboardEvent):void
{
if (panorama_mc.x<4361 && panorama_mc.x>=-4361)
{Keyboard.LEFT:panorama_mc.x += 20;
}
}
if (panorama_mc.x>0)
{
panorama_mc.x= -panorama_mc.width/2;
}
else if (panorama_mc.x < stage.stageWidth - panorama_mc.width)
{
panorama_mc.x= stage.stageWidth - panorama_mc.width/2 ;
}
}}
stop();
Let me know what you think. Thanks in advance.