Play to and stop (character movement MC)

Hello helpful flash friends. I need some help or a glass of water thrown in my face.

I have a MC which is a lady that raises her arms up and down. From the main timeline i want to tell that “ladyMC” (also sitting on the main timeline) to play to and stop on specific frames. I have tried it two different ways but am obviously missing something.

The first way i tried just using an if/else and getting the current frame #.

if(lady._currentframe < 22){
    	lady.play();
	}else if(lady._currentframe >= 22){
   		lady.stop();
}

The second way i tried setting a variable (which is being passed successfully) so that when the ladyMC hits the frame i want it to stop on, it changes the variable.

lady.play();

	
if(ladyvar==2){
   		lady.stop();
}

In both examples, the ladyMC plays through and never stops. Your help is appreciated. This seems so simple but is driving me crazy.

Thanks so much for the reply. I solved it by putting the code on the MC itself and that seems to work great. I appreciate the response!