|
|
|
This is a simple example of how to use ActionScript 2.0 to cause a sound to play for each of the four events associated with a Button: rollover, mouse button press, mouse button release, and rollout.
Here are the steps to follow to create button sounds for each state. Step 1: Import your sounds to the Library Step 2: Right-click each sound and select Linkage from the popup menu Step 3: Check the Export for ActionScript checkbox and the Export in first frame checkbox Step 4: Enter a short name for each sound in the Identifier box. This name will be used in your ActionScript for the attachSound command. Click OK. Step 5: Create your button on the Stage Step 6: Add a new Layer, select Frame 1 in the Timeline and enter the following script in the ActionScript panel: /*This script causes a sound to be played for each //Define sound variables to be referenced by the play_btn //Attach your sounds to each button state //Define the function to be called on a mouse rollover event //Define the function to be called on mouse button press event //Define the function to be called on mouse button release event p//Define the function to be called on rollout event Step 7: Test your movie. It should behave similar to the example above. Download the file used in this example. Download a Flash 8 format file for this example.
You may also reach me at jsale37 (at) gmail.com |
![]()