一聚教程网:一个值得你收藏的教程网站

热门教程

flash 图片切换效果代码

时间:2022-11-14 23:36:38 编辑:袖梨 来源:一聚教程网

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();
xmlObj.load("xml/xml.xml");
xmlObj.ignoreWhite = true;
xmlObj.onLoad = function (success)
{
fixData(xmlObj);
};
} // End of the function
function fixData(o)
{
var _l1 = 0;
while (_l1 < o.firstChild.childNodes.length)
{
preLoadPic(_l1, o.firstChild.childNodes[_l1].childNodes[2].firstChild);
arrUrl.push(o.firstChild.childNodes[_l1].childNodes[1].firstChild);
arrTitle.push(o.firstChild.childNodes[_l1].childNodes[0].firstChild);
_l1++;
} // end while
linkbutton.onRelease = function ()
{
getURL(arrUrl[0], "_blank");
};
btn1_mc.gotoAndStop(2);
} // End of the function
function preLoadPic(i, u)
{
i++;
eval("img" + i + "_mc").loadMovie(u);
checkPicLoad(i, eval("img" + i + "_mc"));
} // 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 < 5)
{
if (eval("btn" + i + "_mc")._visible == false)
{
return(undefined);
} // end if
i++;
} // end while
clearInterval(picLoadLoop);
startFade();
} // End of the function
function startFade()
{
playerPlay();
} // End of the function
function picFade()
{
nextPic = currentPic == 4 ? (1) : (parseInt(currentPic) + 1);
loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc"));
} // End of the function
function loadFadeTpl(co, no)
{
isFading = true;
linkbutton.onRelease = function ()
{
getURL(arrUrl[nextPic - 1], "_blank");
};
setButtonColor();
fadeTPl_1(co, no);
} // End of the function
function setButtonColor()
{
var i = 1;
while (i < 5)
{
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 (isFading == false)
{
playerStop();
nextPic = cp;
loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc"));
}
else
{
trace(isFading);
} // end if
} // End of the function
function playPrePic()
{
playerStop();
nextPic = currentPic == 1 ? (4) : (parseInt(currentPic) - 1);
loadFadeTpl(eval("img" + currentPic + "_mc"), eval("img" + nextPic + "_mc"));
} // End of the function
function playNextPic()
{
playerStop();
picFade();
} // End of the function
function playerStop()
{
_root.player_mc.gotoAndStop(1);
clearInterval(fadeLoop);
} // End of the function
function playerPlay()
{
_root.player_mc.gotoAndStop(2);
fadeLoop = setInterval(picFade, 4000);
} // 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 isFading = false;
var fadingLoop;
var currPicObj;
var nextPicObj;
picLoadLoop = setInterval(checkFade, 500);
start();

热门栏目