Sonify Your Web Site:
Add Streaming Sound
Unlike download sounds, stream sounds do not require the movie clip approach. To create an Autostart stream sound, add a sound to the root timeline (on or after frame 5), add enough frames to the timeline to see the complete wave form of the sound and set the sync option to stream. Add some empty frames at the end of the timeline after your sound. An Autostart stream sound begins as soon as the Flash Player finishes buffering the stream sound (see Figure 18
The three FlashSound API commands useful for controlling stream sounds are TPlay(targetpath), TStopPlay(targetpath), and TGotoAndStop(targetpath, frame). The target path for the root timeline is "/".Code to play a stream sound:
Code to stop a stream sound:
onClick = "mysound.TPlay('/'); return false">
Play a Stream Sound</a>
Code to rewind a stream sound:
onClick = "mysound.TStopPlay('/');
Stop a Stream Sound</a>
onClick = "mysound.TGotoAndStop('/',1);
return false">Rewind a Stream Sound</a>
The TPlay command starts playing at frame 1 or wherever the player was last stopped. The TStopPlay command acts like a pause button. If you call the TPlay command right after TstopPlay, the Flash Player resumes playback at the pause point. Although there's no explicit rewind command, the TGotoAndStop command is well suited for rewind because it moves the Flash play head to the specified frame and stops there until you tell the Flash Player to resume playback wth TPlay or TGotoAndPlay commands.
Stream Sound Guidelines
Place stream sounds only on the root timeline. A stream sound in a movie clip always downloads rather than streams. You can change the size of the Flash buffers (preloads) before starting playback. Larger buffers reduce the chance of stream interruption, but also increase the delay before playback begins. The _soundbuftime property controls the number of seconds of sound that the Flash Player stores in the buffer. Set the _soundbuftime property to the desired number of seconds to override the default buffer time of five seconds. Add your ActionScript to a frame preceding your sound (see Figures 19
The browser caches stream files; therefore, after a stream has played through completely once, the browser will retrieve the file from the browser cache rather than request it from the Web.
The FlashSound API has many other features. For example, you can create more complex types of interactions or audio applications. Download
the full documentation and explore how you can add interactive invisible sound to your Web site.