QQ空间音乐播放器的制作
个人日记
QQ空间音乐播放器的制作,我研究了很久,最终发现,它的核心部分在代码的歌曲增添上.
(这个播放器我已加密,请不要想去破解它,破解后的代码是错的.)
以下是这个播放器的播放代码,朋友们如要做,可把歌名和网上MP3的地址改一下就是您喜欢的歌曲了.
function loadsound(x)
{
played = 0;
aa = 0;
paused = false;
key = true;
s = new Sound();
s.loadSound(x, true);
trackname = id + 1 + "." + mp3name[id];
s.start();
s.onSoundComplete = function ()
{
id = id == mp3name.length - 1 ? (0) : (id + 1);
loadsound(mp3[id]);
};
mix.gotoAndStop(1);
cp.gotoAndPlay(1);
addList();
} // End of the function
function getid(i)
{
id = int(i);
addList();
clearInterval(poll);
loadsound(mp3[id]);
} // End of the function
function addList()
{
Name = "";
for (var _loc1 = 0; _loc1 < mp3name.length; ++_loc1)
{
num = int(_loc1) + 1;
num = num < 10 ? ("0" + num) : (num);
if (id != _loc1)
{
Name = Name + "<a href=\"asfunction:getid," + _loc1 + "\">" + num + "." + mp3name[_loc1] + "</a><BR>";
continue;
} // end if
Name = Name + "<a href=\"asfunction:getid," + _loc1 + "\"><font color=\"#9900000\">" + num + "." + mp3name[_loc1] + "</font></a><BR>";
} // end of for
musicList.styleSheet = myStyleSheet;
musicList.htmlText = Name;
} // End of the function
function getPlaying()
{
} // End of the function
function setPlaying(state)
{
btn9._visible = state;
btn3._visible = !state;
} // End of the function
function getPlaying()
{
} // End of the function
function setPlaying(state)
{
btn9._visible = state;
btn3._visible = !state;
} // End of the function
function url1()
{
getURL("http://lieri.99927.com/", "_blank");
} // End of the function
var j = 0;
var mp3name = ["劲爆开场", "东女国", "再见!我的爱人", "漫步人生路", "南海姑娘", "吉祥的酥油灯", "月亮升起来", "黑帐篷", "故乡情", "这山·这水", "慈母颂", "雪域名城", "索呀啦", "但愿人长久", "千言万语", "又见炊烟", "山茶花", "小路", "一帘幽梦", "几多愁", "牧人", "夜来香", "忘记他", "香港之夜", "高山青", "甜蜜的小雨", "路边的野花不要采", "鸿雁", "后悔爱上你", "人面桃花"];
var mp3 = ["http://storage.live.com/items/5739916E4F91E638!1454?filename=(%E6%9C%AA%E7%9F%A5Artist)%20-%20Madden%20Opening%20%E5%8A%B2%E7%88%86%E5%BC%80%E5%9C%BA.mp3", "http://117.135.129.181/wap/659567.mp3", "http://220.179.115.78/songmp3/zjwdar.mp3", "http://www.ooloo.com.cn/blog/images/music/805/002.mp3", "http://220.179.115.78/songmp3/nhgn.mp3", "http://117.135.129.181/wap/659568.mp3", "http://117.135.129.181/wap/659569.mp3", "http://117.135.129.181/wap/659578.mp3", "http://117.135.129.181/wap/659577.mp3", "http://117.135.129.181/wap/659576.mp3", "http://117.135.129.181/wap/659575.mp3", "http://117.135.129.181/wap/659574.mp3", "http://117.135.129.181/wap/659573.mp3", "http://bbs.zj60.com/uploadfile/200551115575152833.mp3?wxc", "http://www.dui.la/mp3/denglijun/%C7%A7%D1%D4%CD%F2%D3%EF-%B5%CB%C0%F6%BE%FD.mp3", "http://rnzxx.y2.badudns.cc/lzzgw/upload/20103281801268078.mp3", "http://www.gdjltv.cn/tvmusic/%c3%f1%b8%e8/%c9%bd%b2%e8%bb%a8.mp3", "http://220.179.115.78/songmp3/xiaolu.mp3", "http://www.sxszx.cn/templates/B118/images/032.mp3?stdfrom=3&http", "http://www.chinarot.com/new/uploadfile/2011-6/20116421452292065.mp3", "http://117.135.129.181/wap/659571.mp3", "http://www.yinxw.com/data/product/product_music/48f0ac2113a44ffcb603616db990484a.mp3", "http://ridxqq.com.am52.nb118.com/%CD%FC%BC%C7%CB%FB.mp3", "http://st.iruan.cn/download/v3gp/singer/41/34.mp3", "http://www.hbwt.com.cn/images/Uploadfiles/jtyyjks/qnjxc/4nj8c/6hxq/%B0%A2%C0%EF%C9%BD%B5%C4%B9%C3%C4%EF%5B%B8%E8%C7%FA%5D.mp3", "http://210.40.132.141:81/mp3/%B5%CB%C0%F6%BE%FD/%B5%CB%C0%F6%BE%FD%BE%AB%D1%A1%D7%A8%BC%AD7/%CC%F0%C3%DB%B5%C4%D0%A1%D3%EA.mp3", "http://news.lnd.com.cn/site1/20100706/005056c000010d9cc60b4f.mp3", "http://117.135.129.181/wap/659572.mp3", "http://61.133.116.56:801/reslib/400/100/090/020/030/L000000000218330.mp3", "http://www.sumingquan.cn/attachments/month_0701/d200713123134.mp3"];
var s = new Sound();
var s = new Sound();
var id = 0;
var played = 0;
var key = true;
cssText = "a:link{text-decoration: none;font-size:12px;} a:hover{color:#ff0000; text-decoration: underline;font-size:12px;} a:active{color:#990000;text-decoration: none;font-size:12px;}";
myStyleSheet = new TextField.StyleSheet();
myStyleSheet.parseCSS(cssText);
var Name;
addList();
this.addProperty("playing", getPlaying, setPlaying);
btn3._visible = false;
btn1.onPress = function ()
{
id = id == 0 ? (mp3name.length - 1) : (id - 1);
loadsound(mp3[id]);
};
btn2.onPress = function ()
{
if (key)
{
s.stop();
trackname = "STOP";
mix.gotoAndPlay(1);
cp.gotoAndStop(4);
played = 0;
key = false;
s = new Sound();
} // end if
playing = false;
};
btn9.onPress = function ()
{
if (key)
{
played = s.position;
s.stop();
mix.gotoAndPlay(1);
cp.gotoAndStop(4);
trackname = "PAUSED";
}
else
{
loadsound(mp3[id]);
} // end else if
playing = false;
};
btn3.onPress = function ()
{
if (key)
{
s.start(played / 1000, 1);
trackname = id + 1 + "." + mp3name[id];
mix.gotoAndStop(1);
cp.gotoAndPlay(1);
}
else
{
loadsound(mp3[id]);
} // end else if
playing = true;
};
btn4.onPress = function ()
{
id = id == mp3name.length - 1 ? (0) : (id + 1);
loadsound(mp3[id]);
};
btn5.onRelease = function ()
{
s.start(s.position / 1000 - 10, 1);
playing = true;
};
btn6.onRelease = function ()
{
s.start(s.position / 1000 + 10, 1);
playing = true;
};
loadsound(mp3[id]);
var time1 = time2 = time3 = time4 = 0;
var yyy = loadings._x;
this.onEnterFrame = function ()
{
l = s.getBytesLoaded();
loading._width = l / m * 280;
m = s.getBytesTotal();
b = int(l / m * 100);
txt1 = b + "%";
txt2 = int(l / 1000) / 1000 + "M" + " | " + int(m / 1000) / 1000 + "M";
time1 = int(s.position / 60000) < 10 ? ("0" + int(s.position / 60000)) : (int(s.position / 60000));
time2 = int(s.position / 1000 % 60) < 10 ? ("0" + int(s.position / 1000 % 60)) : (int(s.position / 1000 % 60));
time3 = int(s.duration / 60000) < 10 ? ("0" + int(s.duration / 60000)) : (int(s.duration / 60000));
time4 = int(s.duration / 1000 % 60) < 10 ? ("0" + int(s.duration / 1000 % 60)) : (int(s.duration / 1000 % 60));
timeline = time1 + ":" + time2 + " | " + time3 + ":" + time4;
aa = s.position;
bb = s.duration;
loadings._width = int(aa) / int(bb) * 280;
if (int(s.position) <= 1000)
{
ldmc.play();
aa = aa + 1;
if (aa >= 300)
{
ldmc.gotoAndStop(11);
} // end if
}
else
{
ldmc.gotoAndStop(10);
ldmc.preload._width = l / m * 118;
} // end else if
};
stop ();
上述代码的使用方法是:新建元件-------粘贴上述代码在"动作"里,再新建一层做标签,
标签的帧为 stop 这样就可显示歌名了.不做标签,歌可放,但看不到歌名.
这个元件做好后,拖到场景里就行了.当然,播放器的图和按钮就得靠您去做了.建议新
手不要去做,因看似简单的播放器,做起很复杂的.高手们可做一下,试试自已的手艺.
文章评论
魅力永随··
[M][ft=#660000,4,]呵呵沙发[/ft][/M] [M][em]e192[/em][/M]
魅力永随··
[M][ft=#660000,4,]欣赏[/ft][/M] [M][ft=#660000,4,]辛苦了[/ft][/M] [M][em]e160[/em][/M]
呔逅?
[M][B][ft=,5,][ft=#ff0033,6,]好聽!謝謝先生。[/ft][em]e179[/em][em]e179[/em][em]e179[/em][em]e163[/em][/ft][/B][/M]
呔逅?
[M][em]e179[/em][em]e142[/em][em]e163[/em][ft=#cc0000,6,][B]欣賞了,謝謝![/B][/ft][/M]
逸然
[ft=,2,][em]e179[/em][em]e142[/em][em]e163[/em][em]e160[/em][/ft]
[em]e328081[/em]かな雪花飄かな[em]e328139[/em]拒聊
[M][url=http://b78.photo.store.qq.com/http_imgload.cgi?/rurl4_b=52d34dc00fc9a413fc03e5d526b80b91a216066e6dffd314cd5304e637fa453425c8167ffb9a3bbe82f82dbc14aff77bfc49abb037c5eb96cd2b90a9a14f85717b3be178529be811ad133d494ccda149b8a62f7d&a=78&b=78][img]http://b78.photo.store.qq.com/http_imgload.cgi?/rurl4_b=52d34dc00fc9a413fc03e5d526b80b91a216066e6dffd314cd5304e637fa453425c8167ffb9a3bbe82f82dbc14aff77bfc49abb037c5eb96cd2b90a9a14f85717b3be178529be811ad133d494ccda149b8a62f7d&a=78&b=78[/img][/url][/M]
[em]e328081[/em]かな雪花飄かな[em]e328139[/em]拒聊
[M][url=http://b81.photo.store.qq.com/http_imgload.cgi?/rurl4_b=52d34dc00fc9a413fc03e5d526b80b919e0f291b9fe1bf4eade8eb2017e8bad1df75dd420d828aba5fca9bcadbe81f060d0ac508c99b0cc10874a9d26ccae9f8e89f73efa4135af23d28234a90c5ab1b5bbe465a&a=81&b=81][img,280,100]http://b81.photo.store.qq.com/http_imgload.cgi?/rurl4_b=52d34dc00fc9a413fc03e5d526b80b919e0f291b9fe1bf4eade8eb2017e8bad1df75dd420d828aba5fca9bcadbe81f060d0ac508c99b0cc10874a9d26ccae9f8e89f73efa4135af23d28234a90c5ab1b5bbe465a&a=81&b=81[/img][/url][/M]
[em]e328081[/em]かな雪花飄かな[em]e328139[/em]拒聊
[M][url=http://b81.photo.store.qq.com/http_imgload.cgi?/rurl4_b=52d34dc00fc9a413fc03e5d526b80b919e0f291b9fe1bf4eade8eb2017e8bad1df75dd420d828aba5fca9bcadbe81f060d0ac508c99b0cc10874a9d26ccae9f8e89f73efa4135af23d28234a90c5ab1b5bbe465a&a=81&b=81][img,280,100]http://b81.photo.store.qq.com/http_imgload.cgi?/rurl4_b=52d34dc00fc9a413fc03e5d526b80b919e0f291b9fe1bf4eade8eb2017e8bad1df75dd420d828aba5fca9bcadbe81f060d0ac508c99b0cc10874a9d26ccae9f8e89f73efa4135af23d28234a90c5ab1b5bbe465a&a=81&b=81[/img][/url][/M]
妮娜
[M][url=http://b77.photo.store.qq.com/psu?/eb1bc1a6-0723-447e-9195-8d0ebf478328/.GioKHnzlYZ*W3NWPuOKlxydNG5xh7ir6iu3UOnBqyg!/b/YZaY9y0RKQAAYt9o6y0*hgAA][img]http://b77.photo.store.qq.com/psu?/eb1bc1a6-0723-447e-9195-8d0ebf478328/.GioKHnzlYZ*W3NWPuOKlxydNG5xh7ir6iu3UOnBqyg!/b/YZaY9y0RKQAAYt9o6y0*hgAA&ek=1&kp=1&pt=0&su=0176662577&sce=0-12-12&rf=2-9[/img][/url][/M]
博雅
[em]e100[/em][em]e179[/em]
︶ㄣ晚秋的枫叶ゞ出门休息
[M][url=http://b210.photo.store.qq.com/http_imgload.cgi?/rurl4_b=5baab96beffaf5170b3a7d63709a34466fa8669ad5734e1492cff806cd20f89cee91a7f0a8c699155dd418b1a3a27ee32ca0c597843ebfcf77372ca0940fda42027b9636b5ac3811f47301959144d930ab481dc1&a=210&b=210][img,79,100]http://b210.photo.store.qq.com/http_imgload.cgi?/rurl4_b=5baab96beffaf5170b3a7d63709a34466fa8669ad5734e1492cff806cd20f89cee91a7f0a8c699155dd418b1a3a27ee32ca0c597843ebfcf77372ca0940fda42027b9636b5ac3811f47301959144d930ab481dc1&a=210&b=210[/img][/url][/M] [M][/M] [M] [/M] [M]晚秋的枫叶[/M] [M][url=http://sz3.photo.store.qq.com/http_imgload.cgi?/rurl4_b=46da4be9b51ee9ce6bc8dc766160a253cd8a4ee6384643ab4929b7a447e295c7261123cbce28226c136b2a1e29f71440923a84359cca2415750e7b0f3359afa57da53e6345a28e50413ad063d7bc9df71f48d397][img,273,7]http://b11.photo.store.qq.com/psu?/d2a08406-f3fe-446e-8989-00631a10acb0/XHQo*XY4liI39xyR0Cw21VNG8g.oMqe7*jrS0KRwWXM!/b/YazFDAZoNAAAYsCQkQZ6JAAA&ek=1&kp=1&pt=0&su=1186825895&sce=0-12-12&rf=2-9[/img][/url][/M] [m]让飘飞的红叶带去我温馨的祝福...
︶ㄣ晚秋的枫叶ゞ出门休息
[m] [M][url=http://b210.photo.store.qq.com/http_imgload.cgi?/rurl4_b=5baab96beffaf5170b3a7d63709a34466fa8669ad5734e1492cff806cd20f89cee91a7f0a8c699155dd418b1a3a27ee32ca0c597843ebfcf77372ca0940fda42027b9636b5ac3811f47301959144d930ab481dc1&a=210&b=210][img,79,100]http://b210.photo.store.qq.com/http_imgload.cgi?/rurl4_b=5baab96beffaf5170b3a7d63709a34466fa8669ad5734e1492cff806cd20f89cee91a7f0a8c699155dd418b1a3a27ee32ca0c597843ebfcf77372ca0940fda42027b9636b5ac3811f47301959144d930ab481dc1&a=210&b=210[/img][/url][/M] [M][/M] [M] [/M] [M]晚秋的枫叶[/M] [M][url=http://sz3.photo.store.qq.com/http_imgload.cgi?/rurl4_b=46da4be9b51ee9ce6bc8dc766160a253cd8a4ee6384643ab4929b7a447e295c7261123cbce28226c136b2a1e29f71440923a84359cca2415750e7b0f3359afa57da53e6345a28e50413ad063d7bc9df71f48d397][img,273,7]http://b11.photo.store.qq.com/psu?/d2a08406-f3fe-446e-8989-00631a10acb0/XHQo*XY4liI39xyR0Cw21VNG8g.oMqe7*jrS0KRwWXM!/b/YazFDAZoNAAAYsCQkQZ6JAAA&ek=1&kp=1&pt=0&su=1186825895&sce=0-12-12&rf=2-9[/img][/url][/M] [M]让飘飞的红叶带去我温馨的祝福... [/M]
︶ㄣ晚秋的枫叶ゞ出门休息
[m] [M][url=http://b210.photo.store.qq.com/http_imgload.cgi?/rurl4_b=5baab96beffaf5170b3a7d63709a34466fa8669ad5734e1492cff806cd20f89cee91a7f0a8c699155dd418b1a3a27ee32ca0c597843ebfcf77372ca0940fda42027b9636b5ac3811f47301959144d930ab481dc1&a=210&b=210][img,79,100]http://b210.photo.store.qq.com/http_imgload.cgi?/rurl4_b=5baab96beffaf5170b3a7d63709a34466fa8669ad5734e1492cff806cd20f89cee91a7f0a8c699155dd418b1a3a27ee32ca0c597843ebfcf77372ca0940fda42027b9636b5ac3811f47301959144d930ab481dc1&a=210&b=210[/img][/url][/M] [M][/M] [M] [/M] [M]晚秋的枫叶[/M] [M][url=http://sz3.photo.store.qq.com/http_imgload.cgi?/rurl4_b=46da4be9b51ee9ce6bc8dc766160a253cd8a4ee6384643ab4929b7a447e295c7261123cbce28226c136b2a1e29f71440923a84359cca2415750e7b0f3359afa57da53e6345a28e50413ad063d7bc9df71f48d397][img,273,7]http://b11.photo.store.qq.com/psu?/d2a08406-f3fe-446e-8989-00631a10acb0/XHQo*XY4liI39xyR0Cw21VNG8g.oMqe7*jrS0KRwWXM!/b/YazFDAZoNAAAYsCQkQZ6JAAA&ek=1&kp=1&pt=0&su=1186825895&sce=0-12-12&rf=2-9[/img][/url][/M] [M]让飘飞的红叶带去我温馨的祝福... [/M]
博雅
[em]e100[/em][em]e160[/em]
妮娜
[M][em]e195[/em][em]e179[/em][em]e160[/em][em]e163[/em][/M]