Flash music player can be multi-tune + original file

Source: Internet
Author: User
A simple way of saying something, look at my source file specifically.
1. Import four music files, the right key in the library-links, identifiers are: S01 S02 S03 S04
2. Make a volume control, click the control Plus as:
On (Press) {
StartDrag (this, true, left, top, right, bottom);
}
On (release) {
Stopdrag ();
}
Onclipevent (load) {
top = _y;
bottom = _y;
left = _x;
right = _x+150;
_x + 75;
}
Onclipevent (enterframe) {
_root.mysound.setvolume (_x-left);
3. Audio Visual effects
Make a green rectangle, F8 into the movie, the entity name is: line
First frame Plus as:
_root.linemc.line._visible = false;
_root.linemc.onenterframe = function () {
for (var i = 0; i<20; i++) {
Duplicatemovieclip ("line", "line" +i, I);
With (_root.linemc["line" +i]) {
_x + = 4*i;
_y = 0;
_yscale = Math.Round (Math.random () *100);
}
}
};
Stop (); Second frame Plus as:
_root.linemc.line._visible = false;
_root.linemc.onenterframe = function () {
for (var i = 0; i<20; i++) {
Duplicatemovieclip ("line", "line" +i, I);
With (_root.linemc["line" +i]) {
_x + = 4*i;
_y = 0;
_yscale = 25;
}
}
};
Stop (); 4. Put all the accessories, control the Music button entity name: Btnprev btnplay btnpause Btnnext
The third step of the audio visual effect control's entity name is: LINEMC
Pull three dynamic text, the variables are: Pausetotaltime soundname txtbtn
In the first frame plus as:
i = 1;//initial value
S1 = "The Place to kiss good-bye-Hacken";
S2 = "Phone kill order-Kelly";
S3 = "The World only-Joey";
S4 = "More kiss more sad-Jacky";
Mysound = new Sound ();//Create Sound Object
Mysound.attachsound ("S01"), or a sound file in the call library with a link identifier of S01
Mysound.start ()//start playing
Mysound.onsoundcomplete = function () {//automatically called
i++;
if (i>4) {
i = 1;
}
Mysound.attachsound ("S0" +i);
Mysound.start ();
};
Onenterframe = function () {
Pausetimes = Math.Round (mysound.position/1000);//sound file played time
Totaltimes = Math.Round (mysound.duration/1000);//sound file total time
Pausetotaltime = pausetimes+ "s" + "/" +totaltimes+ "s";
Soundname = eval ("s" +i);//analog array
Trace (Pausetotaltime);
Trace (i);
};
var song = true;//declares a variable, and song is True, that is, the sound file is playing
Btnplay.onrelease = function () {
if (song = = False) {
Mysound.start (pausetimes);//start playback from pause seconds
Song = true;
}
_root.linemc.gotoandstop (1);
};
Btnpause.onrelease = function () {
if (song = = True) {
Pausetimes = Math.Round (mysound.position/1000);
Mysound.stop ()/Pause playback
Song = false;
}
_root.linemc.gotoandstop (2);
};
Btnnext.onrelease = function () {
i++;
if (i>4) {
i = 1;
}
Mysound.stop ();
Mysound.attachsound ("S0" +i);
Mysound.start ();
_root.linemc.gotoandstop (1);
};
Btnprev.onrelease = function () {
i--;
if (i<1) {
i = 4;
}
Mysound.stop ();
Mysound.attachsound ("S0" +i);
Mysound.start ();
_root.linemc.gotoandstop (1);
};
Btnprev.onrollover = function () {
_root.txtbtn = "Last Song";
};
Btnplay.onrollover = function () {
_ROOT.TXTBTN = "Play";
};
Btnpause.onrollover = function () {
_ROOT.TXTBTN = "Pause";
};
Btnnext.onrollover = function () {
_root.txtbtn = "Next song";
};
Btnprev.onrollout = function () {
_ROOT.TXTBTN = "";
};
Btnplay.onrollout = function () {
_ROOT.TXTBTN = "";
};
Btnpause.onrollout = function () {
_ROOT.TXTBTN = "";
};
Btnnext.onrollout = function () {
_ROOT.TXTBTN = "";
};

If you feel that the file is too large, you can change the attachsound to Loadsound, load the external music file, the code for partial modification, the same principle.
Because the file is out of standard, the source file deletes the music file. After you open the source file, import four sound files, plus a link identifier. Original file:

Click here to download the source file

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.