You could make a hit test on each side of the screen and then when the player hits it it will gotoAndStop the new frame.