Title: Pausing Sounds (Music)
Author: AEvision
Difficulty: Intermediate
Prerequisites: Creating Buttons

In this toturial, you're going to learn how to pause sound objects in flash and make the sound/music resume exactly from where it was paused.


Note: This tutorial is much shorter than it seems, extra explanation is provided for your own benefit.


There are two ways to do this in flash:


The complicated way:


Using the "Get time" action to calculate the total duration of your sound object, measuring the elapsed time and making the sound object resume next time based on the calculated previous elapsed time. It involves complicated action scripting, which would make this tutorial listed in the "Advanced" category instead. Morover, the result is not always perfect, you can't get a 100% precision when it comes to resuming the sound object from where it was left out.


The easy way:


By setting your sound object to "streaming" and using a couple of simple action scripts to start and pause your sound, 100% precision. And that's what we're going to do in this tutorial. :)
By using "Streaming" sound, it means we are going to spread the music over the timeline of flash. We will place the object into a movie clip and it will be played normally like any flash animation once the "play" button is pressed. Pausing the movie clip in which the object resides will also result in pausing the sound object. We can resume that by using the "play" action again.


Let's get started!



  • Start by creating 2 layers as shown in Fig 1, name them accordingly.

Next, we're going to create a Movie Clip in which our sound object will be placed.

  • Go to Insert>New Symbol and set the settings shown in Fig 2.











Once you create your new symbol, you will be taken to it and you will notice Layer 1.


Now we're going to import our sound to flash.

  • Go to File>Import and import your music or any sound clip (*.wav or *.mp3).






Good :) your sound object is now in the Library of Flash, you can check if you want, go to Windows>Library (or press F11).

  • Select the second keyframe of Layer 1 and select "Insert Keyframe" (there's a good reason behind choosing the second frame instead of the first one, i will explain that in the following steps).
  • Go to Windows>Properties. The Properties panel should appear at the buttom of the screen, select your sound object and set Sync to Stream -as shown below- and Loop to 0 just for this tutorial.


Fig 1


Fig 2




Fig 3




Fig 4

1 | 2 | 3 | Next

Main | Tutorials | BestFlash | Goodies | Forums | Portfolio | Contact Us
AEvision Tutorials 2.1 - All rights reserved AEvision Designs 2002-2007
Icons provided by iconpacks.com