Preloading Attached Sounds


You should be feeling pretty comfortable with most of the Sound object's methods by now. You can make this object do some pretty neat tricks, but before you go out and start adding volume controls and mixers identical to the ones you've made in this chapter, you have to be aware that the sounds attached to each Sound object must load completely before the first frame of your movie will play. Turn on the Show Streaming option for one of the movies you created during an exercise in this chapter to see what happens; you should see a blank screen for some time, until all the sounds that are attached get loaded. That's because sounds that are exported with the movie, but not used in the movie (except through ActionScript), are loaded in the first frame of the movie. This can cause major problems, but there are a few ways around it!

The first thing you can do is make a base movie that uses loadMovieNum or loadMovie to load your volume control or mixer into a level or target. You then can create a preloader inside the base movie that checks whether the entire loaded movie has down-loaded before it enables that movie to play.

Another way to get around the problem is to place all the sounds and Sound objects into a movie that gets loaded into a target. You can use the exported sounds from a loaded movie, as long as you create the Sound object in that movie.



Inside Flash
Inside Flash MX (2nd Edition) (Inside (New Riders))
ISBN: 0735712549
EAN: 2147483647
Year: 2005
Pages: 257
Authors: Jody Keating

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net