Leg Movement Conditional Statement for Game

I have a character in a game that moves in accordance with keyboard commands… I’d like to have it so that when the character moves on the stage his legs simulate walking. Meaning… when moving right, his legs rotate counter clockwise. But since there are two moving at the same time, one moves forward to a point while the other moves back to a point (the legs don’t circle over his head), I need a conditional statement that indicates that when his leg’s rotation is greater than 149, it reverses direction until its at a certain point, then moves back… The below code is for one leg.

addEventListener(Event.ENTER_FRAME, onLoop);
function onLoop(evt:Event): void{

if (Bear.Leg.rotation >=149)
{
Bear.Leg.rotation -=1;}

else {Bear.Leg.rotation +=1;}

I know why this doesn’t work, it passes 149 and then moves back until it’s below 149 and gets stuck in a loop… I need it so that the first statement gets overrided then flips back to it later… How can I do this?