Selteco.com > FlashDesignerZONE.com > Tutorials > T1002

This tutorial demonstrates how to import, play and stop a MP3 sound using Flash Designer.

Flash file and the web page

Import and play MP3 sounds

Import the loop

  1. Launch Flash Designer and choose "Blank document" from the startup screen
  2. Choose "Movie" > "Import Sound...". Select your MP3 file and click OK. Flash Designer will show the sound in the list. Click OK to close "Sounds" dialog:

  3. Choose "Frame" > "Frame Sound". Select imported sound. Our sound is quite short so we make it play 10 times in the row. Click OK to close the dialog.

  4. Choose "Movie" > "Play Animation" to preview the file in Flash player. You should see a blank frame with the sound playing in the background. Hit "Alt+F4" to close preview.

Add some graphics

We can hear the sound. Now we are ready to add some graphics and animate it.

  1. Choose "Insert" > "Symbol" to display symbols gallery. Choose a symbol you like. It will appear in the design view:

  2. While the symbol remains selected choose "Animation" > "Motion". Change "Blink Effect" to "Pulse" and click OK.

  3. Hit F9 to preview the symbol in Flash player.

Add "Stop" button

If a user doesn't want to hear the sound add a "Stop" button.
  1. Choose "Button" tool:

  2. Click and draw the button somewhere in the right-bottom corner of the frame. While the button is selected choose "Item" > "Set Font". Decrease font size to 10. Click OK. To edit button text choose "Item" > "Edit Properties". Rename the button to "Stop Sound".

  3. To make the button working use the following ActionScript code:

    stopAllSounds();
    

  4. While the button is selected choose "Action" > "On Click". Select "ActionScript" and enter the code in the edit field. Click OK to confirm. Flash will execute the code when the user clicks the button.

    To prevent animation looping and starting the sound over and over define the frame as static. Choose "Frame" > "Frame Delay" and check "Stop" option.

The last thing is to export the animation.

  1. Choose "File" > "Export Flash SWF File" command. Name your swf file and click OK.
  2. Choose "File" > "Export web Page". The page should popup in a blank browser window.

Download Flash Designer source project: t1002.zip (300kb)

Products | Purchase | Downloads | Support | Flash Tutorials | Contact
Copyright © 1999-2017 Selteco Software, Inc. www.selteco.com, ph: +1 810 377 5778