化学怎么学才能学好:FLASH图片播放器的代码问题

来源:百度文库 编辑:高考问答 时间:2024/04/24 14:44:42
图片无法实现循环播放 到最后一个就不动了

代码如下:
function initMC() {
up_btn_mc._y = down_btn_mc._y = list_bg_mc._y = (Stage.height - up_btn_mc._height) - 4;
up_btn_mc.swapDepths(10000);
down_btn_mc.swapDepths(10001);
list_bg_mc.swapDepths(10002);
}
function loadXML(success) {
if (success) {
xml_list = ad_xml.firstChild.childNodes;
xml_len = xml_list.length;
loadSwf();
init_ad_bg();
} else {
trace("");
}
}
function init_ad_bg() {
var i = 1;
while (i < 5) {
ad_load0.duplicateMovieClip(("ad_load" + i), i);
i++;
}
var i = 0;
while (i < 5) {
ads = eval(("ad_load" + i));
ads.loadMovie(xml_list[i].attributes.src);
ads._alpha = 0;
i++;
}
}
function loadSwf() {
onEnterFrame = function () { loadx = loads.getBytesLoaded(); totalx = loads.getBytesTotal(); myBall.loading = loadx / totalx * 100; myBall._alpha = loadx / totalx * 10; if (myBall.loading == 100){ if (myBall.i == (xml_len - 1)){ n = 0; x = 5; up_btn_mc.onRelease = function () { n -= 2; playAD(); }; down_btn_mc.onRelease = function () { playAD(); }; pas = setInterval(playAD, 100); } myBall.ad_img.loadMovie(xml_list[myBall.i].attributes.src); myBall.ad_img._xscale = myBall.ad_img._yscale = 15; myBall.onRelease = function () { n = this.i; playAD(); }; } if (loadx == totalx){ if (num < 5){ this_load_xml = xml_list[num].attributes.src; loads.loadMovie(this_load_xml); loads._xscale = 0; loads._yscale = 0; myBall = list_bg_mc.load_list_mc.ad_show_0.duplicateMovieClip(("adshow_" + num), num); list_bg_mc.load_list_mc.ad_show_0._visible = false; myBall._x = num * 50 + 2; myBall._alpha = 0; myBall.i = num; num++; } else { delete this.onEnterFrame; } } };
};
function playAD() {
clearInterval(pas);
n <= 5 ? n : 0;
n = n >= 0 ? n : 4;
this_ad = eval(("ad_load" + n));
this_ad.i = n;
this_ad._alpha = 0;
this_ad.swapDepths(x);
var i = 0;
while (i < 5) {
list_bg_mc.load_list_mc[("adshow_" + i)]._alpha = 40;
i++;
}
list_bg_mc.load_list_mc[("adshow_" + n)]._alpha = 100;
this_ad.onRelease = function() {
if (xml_list[this.i].attributes.link != "" && xml_list[this.i].attributes.link != "#") {
getURL(xml_list[this.i].attributes.link, xml_list[this.i].attributes.target);
}
};
this_ad.onEnterFrame = function() {
this._alpha += 3;
if (this._alpha >= 100) {
delete this.onEnterFrame;
}
};
n++;
x++;
pas = setInterval(playAD, playtime);
}
initMC();
Stage.align = "TL";
System.useCodepage = false;
var ad_xml = new XML();
var xml_list = new Array();
var xml_len = new Number();
var x = new Number();
var n = new Number();
var num = new Number();
var pas = new Number();
var playtime = 10000;
ad_xml.ignoreWhite = true;
ad_xml.load("http://www.XXXXX.com/XXX.xml");
ad_xml.onLoad = loadXML;
高手们帮忙改正啊,使其实现循环播放。

扑通。。你用脚本助手从头写一遍!