Simple control of cyclic sound

zhaozj2021-02-17  48

Yesterday, my friend asked me a little problem about the voice. I didn't want to have a big problem, but I didn't know how, I ran to the Internet to view it. I have asked a few friends who have mentioned this issue. I think Take a few minutes of time slightly talk about the most simple loop control problem. In the following example, I will use several ways to control the loop of the sound: the way the program is used and the normal mode in the MC is implemented in two modes.

In the scene, we have the corresponding objects in the figure, where we set the export under the Symbol Linkage Propertyes of the sound to loop, then set three buttons in the primary field, and enter the following code in the first frame FRAME: fscommand ("Allowscale "," 0 "); Yoursound = new Sound (); Yoursound.attachSound (" loop "); // Bind sound

Next we enter the following code in the first button: ActionS for bt_ason (release) {Yoursound.Start (0, 3);} // Let the sound file loop 3 times

Then we create two MCs, as shown:

(Unlimited Circulation MC)

The first frame is STOP (); the last frame is gotoandplay; "start");

(Finite Cycle MC) // The first frame is stop (); then we set the following code in the button in the main scene: on (release) {_root.music.gotoandPlay ("start");} // Unlimited loop (MC's entity name MUSIC)

Actions for bt_mcloopon (transase) {_root.musicloop.gotoandplay ("start");} // Unlimited loop (MC's entity name MUSICLOOP), and set its LOOP attribute in MC 3

As mentioned above, we not only use several different ways to achieve different cycling effects, but also reach a restriction problem of the number of cycles.

转载请注明原文地址:https://www.9cbs.com/read-29316.html

New Post(0)