This instance realizes uses the flash to control the volume the effect, may enter the volume value in the text box to adjust the volume, the final effect and the interface as shown in Figure 1, to achieve this effect, the concrete operation steps are as follows
Figure 1 "Volume Control" interface
The dynamic text boxes used in the production process, as well as ActionScript scripts such as Attachsound () and Getvolume (), are described in the following steps:
1. Create a new movie, set its size to 300xpx250px (in pixels), set its background color to #009900, 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 symbol "symbol", insert a keyframe at frame 1th, select the rectangle from the toolbox, set its contour width to 3.75 units by the property panel, color Black, and set the fill color to this #ffff33, draw the rectangle as shown in Figure 2:
Fig. 2 Fabrication of graphic element "symbol"
3. Return to the main scene, rename the default layer to "input", insert a keyframe at frame 1th, select the Text tool, and enter text in the workspace as shown in Figure 3:
Figure 3 Entering text
Select text text, and in the property panel, set to input text, drag the text box to the right of the text "volume size" and "Your current volume", setting its variable to "volume" and "Volume_old" respectively. As shown in Figure 4:
Figure 4 Adding an input text box
4. Create a new layer, insert a keyframe at frame 1th, open the Library panel to drag and drop the graphic symbol "symbol" into the workspace, usually by copying and pasting to create 2 instances, selecting the Text tool from the toolbox, usually setting its color to black, and entering text on 2 instances as shown in Figure 5:
Figure 5 Making the button
5. Select the 1th keyframe of the Layer "button" and add the following script:
S1 = new Sound ();
The new Sound () function uses the following
New Sound ([target])
The parameter target Sound the movie clip instance of the object operation. This parameter is optional
The constructor, and creates a new Sound object for the specified movie clip. If no target instance is specified, the Sound object controls all sounds in the movie.
S1.attachsound ("Dongua");
Attaches the sound specified in the Dongua parameter to the specified Sound object. The sound must be in the library of the current movie and must already be specified as an export in the Component Link Properties dialog box. You must call Sound.start to start playing the sound, such as the following statement.
S1.start ();
Volume_old = S1.getvolume ();
Getvolume () is used to return the volume level, which is an integer from 0 to 100, where 0 is closed and 100 represents the maximum volume. The default setting is 100.
Stop ();
Select the two button and add the following script:
Volume Settings button:
On (release) {
if (Volume < 200) {
S1.setvolume (volume);
Get the volume from the Input text box "volume"
Volume_old = S1.getvolume ();
Assign the volume value in the text input box to the input text box volume_old.
}
}
Restart button:
On (release) {
S1.stop ();
Stop playing the current sound
S1.start ();
Play sound from off
}
6. Save the work, press "Ctrl+enter" to preview the final effect.