![]() |
|
|
||||||||||||||||||||||||||||||
|
Use Actionscript to Control a "Sound Only" Timeline Use Actionscript to Control a "Sound Only" Timeline The actionscript for playing and stopping sounds is simple and straightforward. Click the play button and open the actions window. Choose expert mode from the arrow at the upper right corner of the window.
Copy and paste the following actionscript code into the actions window. on (release) {
Do the same for the stop button but change the gotoAndPlay action value to "stop".
Copy and paste the following actionscript code into the actions window. on (release) {
In layman's terms the actionscript means: if the user clicks and releases the mouse over the play button, the flash player should move the playhead to the frame labeled start on the timeline for the movie clip instance "beamscan". By moving the playhead to this frame we start the beam scan sound playing. The actionscript for the stop button simply moves the playhead on this same timeline to the frame labeled stop, which contains the stop sync command for the beam scan sound. This stops playback of the beam scan sound. Now you can test the movie by selecting Test Movie from the control menu. Notice that the play button plays the beam scan sound and the stop button stops playback of the beam scan sound. Below is an embeded flash movie demonstrating actionscript control over a sound only timeline. If you are satisfied with the test, go ahead and export the swf. The next section explains how to use javascript with the FlashSound API to add interactive sound to a conventional web page. Tutorial Navigation: Discuss this tutorial/demo in the Flash Sonification Discussion forum. |
||||||||||||||||||||||||||||||