Playing sound on application load
Although I'm not a huge fan of websites where audio begins to play immediately on application load, I wanted to try and accomplish the effect in Catalyst.
Just be sure to keep a mute or stop button front and center for your users.
We're going to use the Adobe Media Encoder to convert the audio file to a video file.
Why? Well Catalyst offers extremely limited support with audio files in 1.0. We can play them, but otherwise cannot control them (pause, stop). The video support offers much better options for controlling content.
First, choose the audio file you'd like to being immediately playing on application launch.
Open Adobe Media Encoder CS5 (ships with Flash Catalyst).
Drag in your mp3 file, and make sure the output is f4v.
Click start, and it'll encode your mp3 file to an f4v file and output it to the same directory as the original mp3.
Lets leave Media Encoder.
Open Flash Catalyst.
1) From the file menu, select Import Video
2) Navigate and choose the video file you *just* encoding.
3) Click ok. A blank (black screen) video will be created on the artboard.
4) With the video selected, in the properties panel, set the opacity to 0.
5) Additionally, in the layers panel, make sure the video is the bottom most thing in the layers panel. We want it sit behind all of your content and not interfere with mouse interactions.
6) Click anywhere on the gray area outside the artboard, such that nothing is selected anymore.
7) The interactions panel should say "Application"
8 ) Click 'Add Interaction', and choose 'play video', and select your video file from the list of available videos (if you imported one video, there should only be one listed).

Now when your application loads, it will begin playing your sound file right away.
To mute, or pause your video, you can create play/mute buttons like I have shown below:
I will cover how to make these play/mute toggle button control in a future post.

June 25th, 2010 - 08:00
Thanks! Looking forward to your post about how to make the play and mute buttons.
July 14th, 2010 - 01:38
Cool. But how do we loop it?
July 15th, 2010 - 20:16
First off, I’m so glad to see somebody finally has a Flash Cat blog up! Thanks!
I designed a simple portfolio viewer for my site, and it works great locally, however, when I upload the deploy-to-web folder to my web host, the mp3 sound effects that should trigger when I click a roll-over don’t work! Will converting my mp3s to f4vs solve this problem? I’m so confused!
Here’s a link to the page in question…
http://www.pixelregime.com/portfolio.html
July 15th, 2010 - 21:36
DOH! Nevermind. Answered my own question. Hopefully in future versions the deploy-to-web will have as much support for mp3s as f4vs.
July 29th, 2010 - 15:03
Hi, can i use the same control for more than one music?
August 4th, 2010 - 15:01
You can set the source property on the control to play different sound files with the same control.
August 22nd, 2010 - 11:16
Hi!
Nice tip!
Thank you
But when I’m changing the state, music is stopping…
Can you make the music’s going on, even if you change it?
Thx
Jeff
August 23rd, 2010 - 19:09
I’m pretty sure the music will stop whenever you change state. However, you could have the sound clip play on your main application page, and transition the states of a custom component.
December 8th, 2010 - 21:25
Hi,
I am stuck with my website in Flash Catalyst where I have sound on/off toggle button. My music is playing in the background and I have put the video outside the artboard instead of beneath the layers.I think no problem in that. However, I don’t know how to play the video again when I hit the mute button which is an image I have put inside the toggle button on selected areas.I was waiting eagerly for your next post for toggle buttons.
December 10th, 2010 - 11:42
Hi there,
I’m not quite sure about the layout of your project, but it sounds like you may be having trouble with the fact that in Catalyst 1.0, you cannot target anything except items in the current document. For example, if you have a video player and a custom component with a button inside, the button can’t target the video player. This restriction has been relaxed in Panini, so you may want to try out the preview build over at Adobe Labs.
July 22nd, 2011 - 06:24
Hi,
Thanks for all the help. I really need to work out how to stop/mute sound. Have you posted anything on this yet?