Browse DevX
Sign up for e-mail newsletters from DevX


FlashSound API: The Sound of Invisible Flash

Learn to use Flash to add interactive sound to your Web pages.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

ave you ever wanted to add interactive sound and backing music to a Web site but were unable to use Flash because you didn't require any visual presentation? Now there's a new way to "sonify" Web sites—the FlashSound Javascript API. The FlashSound API allows you to add interactive sound to a Web site by using the nearly ubiquitous Flash player to play sound-only invisible movies. The benefit is that you can create a Web site using easy-to-maintain HTML/JavaScript and conventional Web graphic formats while simultaneously playing interactive sound via Macromedia's Flash Player. Because sound-only movies have no user interface, they don't change your layout and they don't rely upon Flash graphics to work.Using the FlashSound API you add interactive sound to links, graphics, and buttons on your site and any user with the Flash 4 Player or better installed can hear them. Best of all, users who don't have the Flash Player installed can see and use the same pages, silently, without any problems. This means there's no need to create a separate non-Flash version of your Flash-enabled Web site; you merely have the option now to add interactive, invisible sound to an existing site.

What Is the FlashSound API?
The FlashSound API is a small JavaScript library developed by Sonify.org that enables you to trigger interactive audio from ordinary HTML pages, using the Flash Player. The FlashSound API handles browser detection, player detection, and SWF embedding for you. With some simple JavaScript code you can enable backing music or interactive sound in any Web site.What do you need for this tutorial?
This tutorial is intended for developers who are familiar with HTML and JavaScript but are new to Flash. You should be up and running in a matter of minutes.

Download and install the free 30-day trial Flash Authoring Application from Macromedia.Acquire audio samples (wav for Windows/aiff for MacOS) either from the Web, a CD, or from the Flash 5 Sound Common library.

Try these examples.

Do not play stream sounds with the window.onload event. If you specify a stream sound in the onLoad event, the browser will download the entire file (treat it as a download) rather than play the file as a stream.
Do not loop stream sounds with the sound panel. This replicates the sound within your movie, drastically increasing file size. Generally, you should loop only download sounds.
To control sound playback within the browser, create a sound-only movie to contain your sounds. Each sound has a corresponding sound-only movie clip and each movie clip must have an instance name. Use the FlashSound API code template to easily add sound to your site. Remember that each embedded SWF must have its own FlashSound instance name and embedSWF( ) statement. Use the TGotoAndPlay( ) method to control download sounds and the TPlay( ) and TStopPlay( ) methods to control stream sounds.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date