2 Replies Latest reply on Apr 11, 2007 11:15 AM by peterent

    Fast Forward


      Im trying to creat a fast forward button. When I press the button it works but it only runs the function once thus making the user click over and over to fast forward. I want it to keep moving the frames when the buttion is held down. I believe I need to loop the event or function? But I cant figure out how to do this.

      private function FastForwardButtonHandler(e:Event):void{
      trace("FastForwardButtonHandler fired");

      swfContent.gotoAndPlay(swfContent.currentFrame + 10);


      <mx:Button label="FastForward" id="FastForward" left="16" width="94" top="380"
      height="22" mouseDown="FastForwardButtonHandler(event)" />
        • 1. Re: Fast Forward
          Use an enterframe event, or a timer. Just be sure to clear it when you're done with it. In my example, I used a stop button (stopbtn) to clear the enter frame.

          Also.. shouldn't you be naming your function starting with a lowercase letter? Upper case letters are for classes.

          private function fastForwardButtonHandler(e:MouseEvent):void{
          trace("fastForwardButtonHandler fired");
          ffbtn.addEventListener(Event.ENTER_FRAME, fastForward);
          stopbtn.addEventListner(MouseEvent.CLICK, stopFF);

          private function fastForward(e:Event){
          swfContent.gotoAndPlay(swfContent.currentFrame + 10);

          private function stopFF(e:Event){
          ffbtn.removeEventListner(Event.ENTER_FRAME, fastForward);
          • 2. Re: Fast Forward
            peterent Level 2
            Set the Button's autoRepeat property to true:

            <mx:Button autoRepeat="true" ... />