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
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(){
position=0;
mysound.stop();
name_txt.text="stop";
}
next_btn.onRelease=function(){
if(mid==count) mid=1;
else mid++;
soundid(music[mid-1].url,music[mid-1].name);
}
prev_btn.onRelease=function(){
if(mid==1) mid=count;
else mid--;
soundid(music[mid-1].url,music[mid-1].name);
}
pause_btn.onRelease=function(){
position=mysound.position/1000;
mysound.stop();
name_txt.text="pause";
soundbool=true;
}
this._parent.onEnterFrame=function(){
var f=(mysound.position/mysound.duration)*100;
if(isNaN(f)==false){
this.control_mc.process_mc.proc_mc._xscale=f;
}
}
这是现在的代码,请问怎么改啊,谢谢~~