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
- Launch Flash Designer and choose "Blank document" from the startup screen
- 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:
- 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.
- 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.
- Choose "Insert" > "Symbol" to display symbols gallery. Choose a symbol you like. It will appear in the design view:
- While the symbol remains selected choose "Animation" > "Motion".
Change "Blink Effect" to "Pulse" and click OK.
- 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.
- Choose "Button" tool:
- 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".
To make the button working use the following ActionScript code:
- 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.
- Choose "File" > "Export Flash SWF File" command. Name your swf file and click OK.
- Choose "File" > "Export web Page". The page should popup in a blank browser window.
Download Flash Designer source project: