|
_root.onLoad=function() { System.useCodePage=true; //XML파일 읽어오기...찾아올 데이터 불러오기 var myList = get("s"); var myLabel = get("t"); var i=-1; //소스리스트 초기화 if (myList==Null) { myList="http://125.241.51.3/myMusicList.xml"; } //라벨 초기화 if (myLabel==Null) { myLabel="Web MP3 Player Ver2.0"; } pmusic.text=""; designer.text=myLabel; myMusicList=new XML(); myMusicList.load(myList); myMusicList.onLoad=function() { rootNode=myMusicList.firstChild; // 메뉴트리를 읽어온다. myOpcount=rootNode.childNodes.length;//문제수를 알아옵니다. }
_root.playbutton.onPress=function () { if (i<(myOpcount-2)) { i=i+2; playMusic(i); } } _root.backbutton.onPress=function () { if (i>1) { i=i-2; playMusic(i); } } _root.stopbutton.onPress=function() { stopAllSounds(); _root.moving.gotoAndStop(1); designer.text="Web MP3 Player Ver2.0";pmusic.text=""; i=-1; }
function playMusic(i) { if (i mTitle=rootNode.childNodes[i].attributes.mtitle; mList=rootNode.childNodes[i].childNodes[0]; stopAllSounds(); mySound=new Sound(); mySound.loadSound(mList,true); pmusic.text=mTitle; _root.moving.gotoAndPlay(2); //플레이 완료 mySound.onSoundComplete = function() { _root.moving.gotoAndStop(1); i=i+2; pmusic.text=""; if (i>=myOpcount) { i=-1; } playMusic(i); } } } }
|