First time here? First time here? Newsletter Signup Newsletter
651326 Members and growing! | Flash Jobs
Search tutorials
Author: Kenny Bellew

How to Fast Forward and Reverse a Sound Object


Fig. 13: Example of fast forwarding and reversing a sound object

The following approach will show how to have the sound skip forward and backward while the fast-forward or rewind button is being held down. In this example, sound will be heard skipping forward or backward, but it will not be legible and it will not sound like audio time is compressed. Experiment with the Flash example in Fig. 13 to understand how it will sound.

When the fast forward button is held down, the sound object will stop, skip forward in position slightly, play very briefly, stop and repeat this cycle until the button is released. The speed of fast-forward or reverse can be controlled by how much is added to or subtracted from the sound object position each time. For this example, the increment is fairly small because the sound is so short. For practical use, a setting of a few seconds should work nicely.

  1. Define your sound object.
  2. Place buttons on the _root timeline. For this example, the reverse button will have the instance name of "REVButton", and the fast-forward button will be called "FFButton".
  3. Place the following code on a one-frame movie clip that loops:

    this.onEnterFrame = function () {
    //Reverse
    if (REV==1 && myMusicPosition>0) {
    _root.myMusic.stop("myMusic01");
    myMusicPosition=myMusicPosition-.5; //The .5 is the decremented amount.
    _root.myMusic.start(myMusicPosition,0);
    }
    revButton.onPress = function () {
    REV=1;
    myMusicPosition=_root.myMusic.position/1000;
    //
    }
    revButton.onRelease = function () {
    REV=0
    }
    //Fast Forward
    if (FF==1 && myMusic.position < myMusic.duration) {
    _root.myMusic.stop("myMusic01");
    myMusicPosition=myMusicPosition+.5;//The .5 is the incremented amount.
    _root.myMusic.start(myMusicPosition,0);
    }
    FFButton.onPress = function () {
    FF=1;
    myMusicPosition=_root.myMusic.position/1000;
    }
    FFButton.onRelease = function () {
    FF=0
    }
    //END
    }

» Level Intermediate

Added: 2002-08-13
Rating: 8.98 Votes: 664
(10 being the highest)
» Author
Kenny Bellew is a technical writer in Minneapolis, MN. He's currently interested in becoming involved in other writing-related Flash projects.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.