Placing Audio in Flash
Audio files are external files. So are bitmaps and vector files. They all come into Flash the same way, through File>Import. The import menu command has three different options. First is File>Import>Import to stage. This command will allow you to import external files directly to the stage. Once imported, the file is automatically added to the library of the resident Flash file. If the imported file is deleted from the stage, the file still remains in the library and can be used repeatedly.
The next menu command is File>Import>Import to Library. This command brings the file directly into the library, bypassing placement on the stage. This command is effective when you are beginning your Flash movie and need to gather your assets into Flash. If all the files were imported to the stage it may get confusing sorting through them all. You would need to delete most of them from the stage in order to get some structure.
The final import choice is File>Import>Open External Library. When choosing a library file, simply click on the FLA file and only the file’s library will open. This menu command allows you to use library file of other flash movies current movie. All symbols and assets in the library can be dragged into your current movie. You can mix symbols in movies easily.
This provides some production shortcuts for you once you begin creating other projects in Flash. You could reuse a button that you liked from a previous movie. To import the sound file you would use the File>Import>Import to Library command. Now that the file is in the library, we can begin to make our on/off audio switch. Once the switch is made, we can place the switch and the splash_intro.swf file together on the index page and we will have a nice simple text animation with audio and an interactive on/off audio switch.
Making the Sound Control in Flash
Now we will move forward into the realm of interactive multimedia and create a sound control button that will turn an audio clip on or off. This audio toggle switch is great for adding voice overs and music to any Web page. The switch sits independently in a layer anywhere on the Web page. You can change the background color and typeface of the audio switch in Flash to adapt it to the visual design of the other pages. As your skills and ambition grow, you can use the building blocks of the design to enhance the switch to include more than one soundtrack or voice over. The switch can evolve into a Flash Jukebox of sorts. Lets get started making a soundtrack switch for our Web portfolio.
Set Up the Movie
The first thing we need to do is set up our new Flash document. File>New>Flash document. Set the size to 125 pixels wide by 25 pixels high. You can adjust the size of the Flash file to fit your specific needs later. Set the background color to white. Setting up the layers before work begins is very important in organizing and eventually editing your Flash document. Set up the following layers in your document:
- Actions
- Labels
- Sound
- Trigger
- Button Text On the actions layer, we will be placing stop actions in the first two frames of the movie. Each stopped frame will have purpose in the interactivity. By isolating the actions on a layer, we can quickly reference our frame actions for editing.
- Insert a keyframe in Frame 1 of the Actions layer
- Go to the Actions Panel click in the action area and type stop();
- Repeat the stop() action for Frame 2.
Set Up Labels
We will be using labels and an invisible button in this exercise. Both items are great for making interactive objects in Flash. A label is a reference point in the Flash timeline. Using labels allows you the freedom of naming points in the timeline descriptively, thus making references in ActionScript a bit more intuitive to program. For instance, you can make ActionScript take the play head to a certain frame in the timeline. Or you can have the play head go to a label point such as Start or Play.
Maybe Stop or Repeat? Labels can be any name you like; the point is that they provide a higher level of control than frame numbers when programming an interactive movie. On the labels layer you will see red flags appear in the timeline at the label points. Don’t worry, the flags are only markers to show where the labels are in the timeline. We will have two labels: Play and Stop.
On the Labels Layer, go to Frame 1 add a keyframe if the frame is empty(F6). On the Properties Inspector, under the word Frame, click in the field and type Play. This label is not seen on the timeline because the frames are so close together. If you roll over the frame slowly you will see the hint box appear with the label name. In the future, you can expand the frames out without changing the animation.
Then you would see the label names in full view.
On the Labels Layer, go to Frame 2 add a keyframe if the frame is empty(F6). On the Properties Inspector, under the word Frame, click in the field and type Stop. We will use these labels for navigating the interactivity of our audio switch.