flash中的script脚本如下:
function fadeTPl_1(co, no) { currPicObj = co; nextPicObj = no; fadingLoop = setInterval(function () { if (nextPicObj._alpha >= 100 && currentPic._alpha <= 0) { clearInterval(fadingLoop); currentPic = nextPic; isFading = false; return(undefined); } // end if currPicObj._alpha = currPicObj._alpha - 10; nextPicObj._alpha = nextPicObj._alpha + 10; }, 50); } // End of the function function getData() { var xmlObj = new XML(); var _l1 = "http://movie.xunlei.com/fade.xml?cacheTime=" + new Date(); xmlObj.load(_l1); xmlObj.ignoreWhite = true; xmlObj.onLoad = function (success) { fixData(xmlObj); }; } // End of the function function fixData(o) { var i = 0; while (i < o.firstChild.childNodes.length) { arrImg.push(o.firstChild.childNodes[i].childNodes[2].firstChild); arrUrl.push(o.firstChild.childNodes[i].childNodes[1].firstChild); arrTitle.push(o.firstChild.childNodes[i].childNodes[0].firstChild); i++; } // end while img1_mc.loadMovie(arrImg[0]); img2_mc.loadMovie(arrImg[1]); linkbutton.onRelease = function () { getURL(htmlReplace(arrUrl[0]), "_blank"); flash.external.ExternalInterface.call("fls_onClick", "0"); }; setTitleInfo(arrTitle[0], arrUrl[0]); btn1_mc.gotoAndStop(2); } // End of the function function preLoadPic(i) { if (i == 7) { i = 0; } // end if if (isLoading[i]) { return(undefined); } // end if i++; eval("img" + i + "_mc").loadMovie(arrImg[i - 1]); isLoading[i - 1] = true; } // End of the function function checkPicLoad(i, o) { o.onEnterFrame = function () { if (int(o.getBytesLoaded() / o.getBytesTotal() * 100) >= 100) { eval("btn" + i + "_mc")._visible = true; delete o["onEnterFrame"]; } // end if }; } // End of the function function start() { getData(); } // End of the function function checkFade() { var i = 1; while (i < 8) { if (eval("btn" + i + "_mc")._visible == false) { return(undefined); } // end if i++; } // end while clearInterval(picLoadLoop); startFade(); } // End of the function function startFade() { fadeLoop = setInterval(picFade, 4000); } // End of the function function picFade() { nextPic = currentPic == 7 ? (1) : (parseInt(currentPic) + 1); loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc")); } // End of the function function loadFadeTpl(co, no) { preLoadPic(nextPic); isFading = true; linkbutton.onRelease = function () { getURL(htmlReplace(arrUrl[nextPic - 1]), "_blank"); flash.external.ExternalInterface.call("fls_onClick", nextPic - 1); }; setTitleInfo(arrTitle[nextPic - 1], arrUrl[nextPic - 1]); setButtonColor(); fadeTPl_1(co, no); } // End of the function function setButtonColor() { var i = 1; while (i < 8) { eval("btn" + i + "_mc").gotoAndStop(1); i++; } // end while eval("btn" + nextPic + "_mc").gotoAndStop(2); } // End of the function function setCurrPic(cp) { if (currentPic == cp) { return(undefined); } // end if if (!isLoading[cp - 1]) { eval("img" + cp + "_mc").loadMovie(arrImg[cp - 1]); isLoading[cp - 1] = true; } // end if if (isFading == false) { playerStop(); nextPic = cp; loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc")); fadeLoop = setInterval(picFade, 7000); } else { trace(isFading); } // end if } // End of the function function setTitleInfo(txt, url) { title_mc.title_txt.text = txt; title_mc.onRelease = function () { getURL(url, "_blank"); }; } // End of the function function playerStop() { clearInterval(fadeLoop); } // End of the function function htmlReplace(str) { var _l1 = str.toString(); if (_l1.indexOf("&") != -1) { _l1 = _l1.split("&"); return(_l1.join("&")); } // end if return(_l1); } // End of the function stop(); Stage.scaleMode = "noScale"; Stage.showMenu = false; System.useCodepage = false; var picLoadLoop; var fadeLoop; var currentPic = 1; var nextPic; var arrUrl = []; var arrTitle = []; var arrImg = []; var isFading = false; var isLoading = [true, true, false, false, false, false, false]; var fadingLoop; var currPicObj; var nextPicObj; picLoadLoop = setInterval(checkFade, 500); start();
其中红色部分的XML文件如下: <?xml version="1.0" encoding="utf-8" ?> - <content> - <item> <title>《我的野蛮女老师2》追梦女孩儿在日侨胞,踏上了韩国土地!</title> <url>http://movie.xunlei.com/movies/39/38871.html</url> <image>http://images.movie.xunlei.com/gallery/376/22c01c0f03a6162a498979e68ef4c04a.jpg</image> </item> - <item> <title>《哈利波特与凤凰社》小哈利开始了第五年的魔法学习</title> <url>http://m.xunlei.com/zt_htdocs/harrypotter5/</url> <image>http://images.movie.xunlei.com/gallery/376/e5649f841f371e6abbe47a571401a656.jpg</image> </item> - <item> <title>《黑暗侵袭》地下洞穴中,黑暗的生物正向她们袭去</title> <url>http://movie.xunlei.com/movies/34/33740.html</url> <image>http://images.movie.xunlei.com/gallery/375/dc04a5fcfcacd89d84699c72aebf154f.jpg</image> </item> - <item> <title>有谁亲身游历过那座精艳绝伦的“万园之园”?</title> <url>http://movie.xunlei.com/movies/36/35745.html</url> <image>http://images.movie.xunlei.com/gallery/375/d4142444b3d78dbfdbed6cb6ddc9e673.jpg</image> </item> - <item> <title>《星际传奇2》星际中唯有杀死敌人才能活下去</title> <url>http://movie.xunlei.com/movies/29/28585.html</url> <image>http://images.movie.xunlei.com/gallery/375/478db2c23b1223a4d3d2a9e158556263.jpg</image> </item> - <item> <title>《太妹刑事》持摇摇的可爱女生松浦亚弥出来主持正义了</title> <url>http://movie.xunlei.com/movies/38/37233.html</url> <image>http://images.movie.xunlei.com/gallery/375/0b7b2474fd5d46034b1f7906fe3d25f7.jpg</image> </item> - <item> <title>《超级礼物》改编自吉姆·斯托维尔的同名最畅销小说</title> <url>http://movie.xunlei.com/movies/38/37755.html</url> <image>http://images.movie.xunlei.com/gallery/375/00f728ca882c5cf4e3fba5806f74177a.jpg</image> </item> </content>
|