The control of music by using as as in Flash animation

Source: Internet
Author: User
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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.