![]() |
|
|
|||||||||||||||||||||||||||||||
|
Use the FlashSound Javascript API to Control a "Sound Only" Timeline When using the FlashSound Javascript API to control the flash player, we do not need to use flash for both graphics and sound. Instead we can create our own custom gif/jpeg/html interface and use the flash player only for playing sound. Consequently, we dont need to create any flash graphics for our "sound only" swf. If you plan to create "sound only" movies, you can skip the parts of this tutorial that pertain to adding buttons to the main timeline and attaching actionscript to buttons. Click on these links to start and stop the beam scan sound using javascript: Using javascript with the flash player is slightly different than the previous actionscript example. The TGotoAndPlay( ) method of the FlashSound Javascript API is a combination of the tellTarget and gotoAndPlay actions. TGotoAndPlay( ) has two values passed to it. The first is the target timeline name in slash notation and the second is the frame number or label for playback to start. The slash indicates that the target timeline is a child of the parent timeline. Just as in our actionscript example we can create two links, one for play and one for stop. <p><a href = "javascript://" onClick = "mysound.TGotoAndPlay('/beamscan','start'); return false">Play the sound</a></p> <p><a href = "javascript://" onClick = "mysound.TGotoAndPlay('/beamscan','stop'); return false">Stop the sound</a></p> In these links we use a dummy url "javascript://" and the onClick = "return false" to prevent a web browser from acting on the url. This is a common technique for making html links that play sounds without loading a new webpage. Below is the complete html and javascript.
Review the summary of this tutorial. Tutorial Navigation: Discuss this tutorial/demo in the Flash Sonification Discussion forum. |
|||||||||||||||||||||||||||||||