Printer Friendly Version

BellaOnline's Flash and Animation Editor

Using Sound in Flash iOS Storybook App

In this tutorial, we will add some ActionScript that will tell Flash CS5.5 to play a sound file when the reader clicks on one of the Christmas ornaments. We have the option of using the same sound file for all three ornaments or "attaching" a different sound file to each ornament. As always, this decision will depend on all the other elements added to your app and the final file size.

We already have the ornaments on the stage and they are animated to sway. This animation is a Tween that plays inside each ornament movie clip. Because we have added the ornament movie clips to Frame 1 of the Timeline, the animation will start when the app loads and will continue until we remove the ornament movie clips from the stage.

We also want our readers to be able to click on the ornaments and play a jingle sound file. Although the ornaments are movie clips and not buttons, we will use ActionScript to tell Flash that our movie clips will also function as buttons.

Although Flash accepts several sound file formats, it's best to covert the file to mp3 format for mobile apps. Once you have the file in mp3 format, you are ready to import it into your project.

Open the storybook project file.

    1. From the menu, click File - Import - Import to Library and choose the sound file.

    In the Library Panel you will find the imported sound file. We will be controlling the sound file with ActionScript. In order to do this we need to make a change to the file by linking it to a class.

    2. Right-click on the sound file and choose Properties. In the Sound Properties dialog box, click the ActionScript tab. Check the box next to Export to ActionScript.

    3. You will notice that the name of the sound file appears in the Class text box. Remove the file extension .mp3. This sound file now has a Class linked to it with the same name.

It is standard to place all the ActionScript on its own layer in the Timeline. Just as we have a layer for the red ornament, we will have an actions layer.

Next →

Join us in the Digital Art and Design forum. | Join us in the Flash forum.

Flash and Animation Site @ BellaOnline
View This Article in Regular Layout

Content copyright © 2013 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact Diane Cipollo for details.

| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2018 Minerva WebWorks LLC. All rights reserved.

BellaOnline Editor