flashxml.txt
来自「请认真阅读您的文件包然后写出其具体功能(至少要20个字)。尽量不要让站长把时间都」· 文本 代码 · 共 2,207 行 · 第 1/5 页
TXT
2,207 行
var _l8 = this.firstChild.childNodes.length;
var i = 0;
while (i < _l8)
{
var _l3 = this.firstChild.childNodes[i].childNodes;
pic_list.push({url: _l3[0].firstChild.nodeValue, link: _l3[1].firstChild.nodeValue, description: _l3[2].firstChild.nodeValue, title: "img1"});
i++;
} // end while
for (i = 0; i < pic_list.length; i++)
{
_root.createEmptyMovieClip("container" + i, getNextHighestDepth());
_root["container" + i]._x = 0;
_root["mcListener" + i] = new Object();
_root["mcLoader" + i] = new MovieClipLoader();
_root["mcLoader" + i].addListener(_root["mcListener" + i]);
loadimg_mc.loadClip(pic_list[i].url, _root["container" + i]);
_root["mcListener" + i].onLoadComplete = function (mc)
{
_root["container" + i]._visible = false;
_root.loadedimg++;
};
} // end of for
btn1.gotoAndStop(2);
loadimg_mc.loadMovie(pic_list[0].url);
w = 1;
k = 1;
urls = pic_list[0].link;
os = 1;
_root.createEmptyMovieClip("imgdisplay", 2);
_root.imgdisplay.setMask(totalmask_mc);
var i = 0;
while (i < pic_list.length)
{
_root.imgdisplay.attachMovie("img_holder", "img" + i, _root.imgdisplay.getNextHighestDepth());
_root.imgdisplay["img" + i]._x = _root.imgdisplay["img" + (i - 1)]._x + 90;
i++;
} // end while
}
else
{
trace("error loading XML");
} // end if
};
pic_xml.load("top2.xml");
btn1.onRollOver = function ()
{
btn1.gotoAndStop(2);
};
btn1.onPress = function ()
{
changepics1();
attachMovie("mask", "mask", this.getNextHighestDepth());
moveyuan1();
w = 1;
k = 1;
};
btn1.onRollOut = function ()
{
if (k == 1)
{
btn1.gotoAndStop(2);
}
else
{
btn1.gotoAndStop(1);
} // end if
k = 0;
};
btn2.onPress = function ()
{
changepics2();
attachMovie("mask", "mask", this.getNextHighestDepth());
w = 2;
r = 1;
moveyuan2();
};
btn2.onRollOver = function ()
{
btn2.gotoAndStop(2);
};
btn2.onRollOut = function ()
{
if (r == 1)
{
btn2.gotoAndStop(2);
}
else
{
btn2.gotoAndStop(1);
} // end if
r = 0;
};
btn3.onPress = function ()
{
changepics3();
attachMovie("mask", "mask", this.getNextHighestDepth());
w = 3;
e = 1;
moveyuan3();
};
btn3.onRollOver = function ()
{
btn3.gotoAndStop(2);
};
btn3.onRollOut = function ()
{
if (e == 1)
{
btn3.gotoAndStop(2);
}
else
{
btn3.gotoAndStop(1);
} // end if
e = 0;
};
btn4.onPress = function ()
{
changepics4();
attachMovie("mask", "mask", this.getNextHighestDepth());
z = 1;
moveyuan4();
};
btn4.onRollOver = function ()
{
btn4.gotoAndStop(2);
};
btn4.onRollOut = function ()
{
if (z == 1)
{
btn4.gotoAndStop(2);
}
else
{
btn4.gotoAndStop(1);
} // end if
z = 0;
};
btn5.onRollOver = function ()
{
btn5.gotoAndStop(2);
};
btn5.onPress = function ()
{
changepics5();
attachMovie("mask", "mask", this.getNextHighestDepth());
moveyuan5();
end = 1;
os = 0;
};
btn5.onRollOut = function ()
{
if (end == 1)
{
btn5.gotoAndStop(2);
}
else
{
btn5.gotoAndStop(1);
} // end if
end = 0;
};
trace("w0=" + w);
goto.onPress = function ()
{
getURL(urls, "_blank");
};
intervalID = setInterval(autochange, 7000);
==================================================
a.做7个按钮剪辑1234567,还有一播放和暂停按钮
b.再做7个剪辑放7个按钮,并在每个按钮上动作
on (press)
{
_root.setCurrPic(this._name.split("_")[0].substring(this._name.split("_")[0].length - 1));
}
在第一帧动作
stop();
在第二帧动作
stop();
c.做一播放和暂停剪辑
在第一帧动作
stop();
在第二帧动作
播放动作
stop();
on (release)
{
_root.playerPlay();
}
暂停动作
on (release)
{
_root.playerStop();
}
d.下一张动作
on (release)
{
_root.playNextPic();
}
上一张动作
on (release)
{
_root.playPrePic();
}
btn1_mc动作
onClipEvent (load)
{
this._visible = false;
}
img234567动作
onClipEvent (load)
{
this._alpha = 0;
}
e.在场景第一帧动作
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 < 8)
{
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 == 7 ? (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 < 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 (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 ? (7) : (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();
MP3
a.control_mc是由以下组成
play_btn,pause_btn,stop_btn,prev_btn,next_btn,process_mc,name_txt,count_txt
在第一帧动作
var music_xml=new XML();
var music=new Array();
var count:Number=0;
music_xml.ignoreWhite=true;
music_xml.onLoad=function(success){
if(success){
parse();
}
}
music_xml.load("xml/music.xml");
//parse()
function parse(){
var e=music_xml.firstChild.childNodes;
count=e.length;
for(var i=0;i<count;i++){
var musicobject=new Object();
musicobject.url=e[i].attributes.url;
musicobject.name=e[i].attributes.name;
music[i]=musicobject;
}
soundid(music[0].url,music[0].name);
}
//
var soundbool=false;
var mid:Number=1;
var position=0;
var mysound:Sound=new Sound();
function soundid(url,name){
mysound.loadSound(url,true);
this.onEnterFrame=function(){
if(mysound.getBytesLoaded()>=mysound.getBytesTotal()){
name_txt.text=name;
count_txt.text=mid+"/"+count;
mysound.start();
delete this.onEnterFrame;
}else{
name_txt.text="loading...";
}
}
}
//
play_btn.onRelease=function(){
if(soundbool==false){
soundid(music[mid-1].url,music[mid-1].name);
}else if(soundbool==true){
mysound.start(position);
name_txt.text=music[mid-1].name;
}
}
stop_btn.onRelease=function(){
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?