Example: Playing a sound file
We will create an application consisting of several files in this example
(an SWF file and a sound MP3 file). The player uses the value of the
mp3file variable as the path to the file that should be played. To show
the player the path to the MP3 file, we will use the SWF variable option
of the compiler. This option allows you to declare variables in the startup
SWF file right before its initialization.
We could specify the variable explicitly right in the SWF file, but we
will use the “SWF variables” option in order to get acquainted
with the features of the compiler.
Do the following to create an application playing a sound file:
- Open SWF Maestro (EXE or SCR).
- Click “New > New From...” and select one of the project
files created in the previous examples.
- Open “Files > Files for compilation”.
- Select “Compile Directory” and specify the path to the “soundplayer” directory
located in the “Tutorials” directory. This directory
contains two files: soundplayer.swf and sound.mp3.
- Use the “Startup file" field to specify the path
- Since “soundplayer.swf” reads the value of the “mp3file” variable,
we will specify it in the “SWF Variables” field. Enter “mp3file=sound.mp3” in
- Click “Save As” to save the project.
- Compile the application.
- Run the application. As you can see, an application created with
SWF Maestro may include a lot of files connected with each other.