stop(); function goBack(evt:MouseEvent):void { if(currentFrame ==1) { gotoAndStop(totalFrames); } else { prevFrame(); } } function goForward(evt:MouseEvent):void { if(currentFrame == totalFrames) { gotoAndStop(1) } else { nextFrame(); } } back_btn.addEventListener(MouseEvent.CLICK, goBack); next_btn.addEventListener(MouseEvent.CLICK, goForward);