Hello,

I'm having a problem with my animation playing for one of my characters, I have a method which is constantly sending the que to play the animation. When i press a key the character accelerates and the animation plays fine, however as soon as i let go of the key and the character begins to decelerate on its own the current frame reverts back to 1 and stays on 1 until i accelerate again. I want it so that the animation continues to play from its current frame rather than reverting back. Here's the code, thanks!

Code:
public function moveSamurai():void{
			if(samuraiXDirection == 1){
				if(samuraiVelocity < Util.maxSpeed){
					samuraiVelocity += Util.acceleration;
				}
			}
			else if(samuraiXDirection == 2){
				if(samuraiVelocity < Util.maxSpeed){
					samuraiVelocity -= Util.acceleration;
				}
			}
			if(samuraiYDirection == 1){
				if(!isJumping){
					jumpPower = 25;
					isJumping = true;
				}
				if(isJumping){
					samuraiYMove += jumpPower;
					jumpPower -= 1;
				}
				if(jumpPower == 0){
					isJumping = false;
				}	
			}
			if(samuraiVelocity >= 0.5 || samuraiVelocity <= -0.5)
				samuraiVelocity = samuraiVelocity * Util.speedDecay;
			else samuraiVelocity = 0;
			samuraiXPos += samuraiVelocity;
			SamuraiChar.move(samuraiVelocity, samuraiYMove);
		}
Code:
		public function move(x:Number, y:Number):void{
			if(x > 0){
				currentlyAttacking = false;
				currentlyMoving = true;
				facingLeft = false;	
				samuraiChar.gotoAndStop(3);
				trace("hit " + samuraiChar.character.currentFrame);
				if(samuraiXPos < currentLevelWidth + (Util.PLAYABLE_WIDTH/2)){
					if(moveToEdge){
						samuraiChar.x += x;
					}
					samuraiXPos += x;
				}
			}
			if(x < 0){
				currentlyAttacking = false;
				currentlyMoving = true;
				facingLeft = true;
				samuraiChar.gotoAndStop(4);
				if(samuraiXPos > 0){
					if(moveToEdge){
						samuraiChar.x += x;
					}
					samuraiXPos += x;
				}
			}
			if(x == 0)
				currentlyMoving = false;
			if(y > 0){
				if(samuraiYPos >= Util.GROUND)
					samuraiYPos += y;
			}
		}