Flash Animation | control
How to use as to realize the control of music?
Solving ideas
Using the frame tag, the switch of the button is used to realize the switching control of the music.
Specific steps
1, first in the scene of the 1th frame add as:
Ss=new Sound ();
Ss.attachsound ("sound");
Ss.start ();
This is the binding voice command, which we have already introduced to you before.
2, and then on the Stop button to add a command:
On (release) {
gotoAndStop ("Off"); Toggle Shadow frame to off frame label
Ss.stop ();
_root.a=ss.position;
}
3, finally on the Start button to add a command:
On (release) {
gotoAndStop ("on"); Toggle Shadow frame to on frame label
Ss.start (_root.a/1000); Change the number of milliseconds to seconds
}
Another method:
1th Frame as:
Ss=new Sound ();
Ss.attachsound ("sound");
Ss.start ();
Ss.onsoundcomplete = function () {
Ss.start ();
};
There is only one button in the scene, and the button adds code:
On (Press) {
a=a+1;
if (a%2==1) {///to judge odd even number, stop at odd number, even when open
Ss.stop ();
_root.b=int (ss.position/1000);
_root.t= "You suspend in the first" +_root.b+ "seconds";
_root.kg= "Music Stop";
} else {
Ss.start (_root.b);
_root.kg= "Music Open";
}
}
Then put two dynamic text boxes in the scene, and the variable name is done.