This example realizes is a sound switch button effect, uses the mouse to click can realize the sound switch control, the final effect as shown in Figure 1, to achieve this effect, the concrete operation steps are as follows:
Figure 1 Sound Buttons
1. Create a new movie, set its size to 200xpx200px (in pixels), set its background color to #0099cc, and of course the user can set it according to the needs. Press "Ctrl+r", the shortcut key opens the Import dialog box, imports a sound file.
2. Create a new graphic element "Circle", select Frame 1th in the timeline to insert a keyframe, press the SHIFT key, use the Ellipse tool to draw a circle in the workspace, delete the fill area, and set the circumference thickness to "1" units (this is the default), and the fill color is white, as shown in Figure 2:
Figure 2 Making "circle" graphic symbols
3. Create a new graphic element "Ripple", select frame 1th, insert a keyframe, insert the made graphic symbol "circle" into the workspace from the library panel, select frame 15th of the layer, plug in a keyframe, and use any trace tool to enlarge the "circle" component in the workspace, and set its transparency value to 0, then select the 1th keyframe, right-click, and select the Create Motion Tween menu command from the pop-up shortcut menu to create a movement gradient effect.
4. Use the same method to create a new 6 layer, at 2 frame intervals, the same "circle" magnified and disappeared effect, the final Timeline window as shown in Figure 3:
Figure 3 Timeline window for "Ripple" components
There are 7 layers stacked together, that is, the sonic diffusion effect can be simulated, press "Enter" to see the effect shown in Figure 4:
Fig. 4 Simulation of acoustic wave diffusion effect
5. Create a New button element "BTN", respectively, design its bounce, pointer passing, press and click Status as shown in Figure 5:
Figure 5 The frame state of the button "BTN"
6. Create a new movie clip "Playmusic", rename the default layer to "button", select Frame 1th to insert a keyframe, drag the button symbol "BTN" to the tool area, and select "Btn" to add the following script to it:
On (release) {
gotoAndStop (10);
}
When you click the mouse, skip to frame 10th and stop.
Select frame 10th of the button layer to insert a keyframe.
7. In the editing state of the movie clip "Playmusic", create a new layer of "playing", select frame 1th to insert a keyframe, drag the movie clip "Ripple" from the library to the workspace, and adjust its position so that it overlaps with the button "BTN", as shown in Figure 6:
Figure 6 Creating an instance of "ripple"
Select the 1th keyframe, add the foot local "stop ();" To wait for the user to click the sound switch, select frame 10th to insert a keyframe, and under that frame, delete the "ripple" instance in the workspace.
8. In the editing state of the movie clip "Playmusic", create a new layer of "sound", select frame 1th, sound files that will also be imported from the library, play to the workspace to make an instance, select frame 10th to insert a keyframe, and add the following code to it:
Stopallsounds ();
Stop playback of all sounds
9. Return to the main scene, the production of the film clip "Playmusic" inserted into the workspace to create the case, that is, complete the entire animation production, save the work, press "Ctrl+enter" preview the final effect.