I want to add a short soundclip that plays when my nav bar loads. I edited down a song in Garageband to 3 seconds, then I exported it to iTunes. I assume I have to convert it to mp3 to put it into my Flash file, so my first question is this... how many kbps should I save the mp3 at? Normally I have mp3's in iTunes that are 128 or 192, but would this make my swf filesize too big? Can anyone suggest a setting? Then, once I convert my mp3 in iTunes, how would I bring it into my flash file and trigger it so it plays when the nav bar loads? Thanks!
As far as encoding MP3s, you'll need to experiment with that to get the best sound to file size ratio. But a 3 second sound can sound terrific and not be big at all. Since this is the Flash forum, I'll answer your second question, regarding how to import sound: // first, create a Sound object: var navBar_sound:Sound = new Sound(_root); // this assumes that your sound file is named navsound.mp3 and it is in the same directory as your SWF file navBar_sound.loadSound("navsound.mp3", false); Now, the trick is to trigger the sound at the right time. The event you've described is "when the nav bar loads." So determine when this is (at the end of a timeline? at the end of a load event?) and place this code in a frame or event handler there: navBar_sound.start(); Determining when the nav bar loads may be the tricky thing here, but without further information, it's hard to say what (specifically) you need to do... Good luck, Albee
I'd like the sound to trigger after the preloader loads everything and while the animation plays (logo flies in, nav bar swoops in from the right, pretty basic). Does this mean I should put the trigger on frame 1 of scene 1? Also, I'm pretty new to Flash and even newer to ActionScript, so where would I put the action that creates the sound object you described above? With the mp3, I encoded it at 128 and it sounds really good, I was just wondering if it's overkill just for a 3 second byte. Does anyone else have any experience with this? I'm really not sure of what is an appropriate file size, is there a number where I shouldn't go over? It's a nav bar animation so I'd like it to load pretty fast. Thanks for your help!
Albee, or whoever knows about this sort of thing, why is using ActionScript superior to just putting the mp3 from the library onto frame 3 with the Properties Inspector? I'm sure there's probably a good reason for it so please explain. Also, does anybody know if I have to set compression on the mp3 once I load it into the library? Or should I mess with the global compression settings in the Publish settings? I've never worked with sound before so any help would be great, thanks...
using actionscript gives you several benefits: 1. if you ever need to edit your sound for some reason, you only need to edit the MP3 file, not the FLA 2. compiling SWFs is much quicker--Flash doesn't have to process the sound file during SWF creation 3. SWF file sized remains small--compare a SWF with sound embedded vs a SWF calling the sound files via actionscript--a huge difference now for your purposes, there is really not much difference between embedding the sound and loading it with actionscript, but if you get into a situation where you have to use a lot of sounds or bigger sound files, it really starts to make a huge difference. using actionscript to solve problems is a great habit to get into... by the way, in response to your ealier post, creating the sound object involves the code that i posted earlier: var navBar_sound:Sound = new Sound(_root); usually, this can be placed in the first frame of your root timeline. by convention, it's a good idea to make a layer for all of your code, and only put code in it... good luck, albee
Hey Albee thanks, just to clarify, this code would go on a separate layer in frame 1, correct? var navBar_sound:Sound = new Sound(_root); navBar_sound.loadSound("navsound.mp3", false); Or would it go on frame 3 considering the preloader takes up the first 2 frames? Since I want the sound to start on frame 3, which is where the nav animation starts, I assume I would put this code in a separate layer on frame 3... navBar_sound.start(); Just want to get it straight, I appreciate the help!
yes. you want the first two lines of code to appear on frame 1: var navBar_sound:Sound = new Sound(_root); navBar_sound.loadSound("navsound.mp3", false); and then on frame three (or wherever you actually want to hear the sound), add: navBar_sound.start(); all code can be on the same layer (hopefully you have a layer dedicated to just code... really helps keep things straight). albee
Don't see what you're looking for? Try a search.
|