Import and Play MP3 Sounds

This tutorial was written for the Flash Designer software, which allows you to create flash animations in a much easier way than by using Macromedia Flash. You may get Flash Designer here.

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

Flash file and the web page

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:

image 1

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.

image 2

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 "Esc" to quit Flash player preview.

Add some graphics

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

1. Choose "Frame" > "Insert Symbol" to display symbols gallery. Choose "Musical Symbols" and select musical note symbol. It will appear in the design view:

image 3

2. While the symbol remains selected choose "Item" > "Sprite". Change speed to "Fast" and click OK to confirm "Fade" effect. The symbol will fade in and out in an infinite loop.

image 4

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:

image 5

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".

image 6

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

stopAllSounds();

4. While the button is selected choose "Item" > "Actions" > "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.

image 7

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

image 8

The last thing is to export the animation.

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

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


Close    To Top
  • Prev Article-Flash:
  • Next Article-Flash:
  • Now: Tutorial for Web and Software Design > Flash > Flash Video > Flash Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction