More dedicated to playing music loops as soundtracks.
1. Edit the MP3 file, and clear out the beginning and end empty spaces; try to achieve a good loop by doing this and testing out in the editing program.
2. Save the mp3 as a WAV.
3. Import the WAV into flash, and edit it's properties; set it's compression to MP3 - this will convert your WAV to an MP3. MP3 files automatically add the empty spaces when compressed into the MP3 format. Importing as a WAV without the spaces, and setting it's compression to MP3 will avoid the spaces.
4. Add an Linkage Identifier to the WAV file (in the following example code: "soundtrackFile") and don't export it on the first frame.
5. After the first frame (which i assume you are going to use to add a preloader, paste the sound on a frame and add a stop to the frame. Sometimes, for unknown reason to me, the sound still plays when the event isn't set to stop. Even when the frame is skipped.
This will give you a good control over the soundtrack.
//SOUNDTRACK CODE
var soundtrack:Sound = new Sound();//create the sound object
soundtrack.attachSound("soundtrackFile");
soundtrack.start(0,99);
soundtrackPlaying = true;
soundtrack.onSoundComplete = function() {
soundtrackPlaying = false;
}
When attaching an MP3 in an SWF that is afterwards loaded into another SWF, add this when creating the sound object:
//SOUNDTRACK CODE
var soundtrack:Sound = new Sound(this);
UPDATE: In Flash CS4 and CS5, you'll need to add an event to the frame, instead of the stop action.
Wednesday, April 14, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment