# =URGENT= Mp3 player help

**URL:** <https://forum.kirupa.com/t/urgent-mp3-player-help/178282>\
**Category:** flash\
**Created:** [February 9, 2006, 3:00am UTC](https://forum.kirupa.com/t/urgent-mp3-player-help/178282 "2006-02-09T03:00:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jimmy\_James](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@Jimmy\_James](https://forum.kirupa.com/u/Jimmy_James)\
**Post date:** [February 9, 2006, 3:00am UTC](https://forum.kirupa.com/t/urgent-mp3-player-help/178282/1 "2006-02-09T03:00:48Z")

</div>

Ive obtained this script of the web and i cant find where to put my Songs again if it is another XML file what is it called and how do i make one:

This is the script:  
stop();  
//autoplay=true  
//repeat\_playlist = true;  
//playlist\_size = 3;  
//player\_title = “customizeable title test”  
//song\_url = “[http://downloads.betterpropaganda.com/music/Imperial\_Teen-Ivanka\_128.mp3](http://downloads.betterpropaganda.com/music/Imperial_Teen-Ivanka_128.mp3)”;  
//playlist\_url = “[http://webjay.org/by/hideout/moviequotes.xspf](http://webjay.org/by/hideout/moviequotes.xspf)”;  
//playlist\_url = “[http://hideout.com.br/shows/radio-test.xspf](http://hideout.com.br/shows/radio-test.xspf)”;  
//radio\_mode = true;  
//song\_title = “Imperial Teen - Ivanka”;  
//autoload=true;  
//info\_button\_text = “Add to Cart”  
//playlist\_url = “http%3A%2F%2Fwebjay%2Eorg%2Fby%2Flucas%5Fgonze%2Flaconic%2Exspf”  
//playlist\_url= “[http://hideout.com.br/tests/hideout2325.xspf](http://hideout.com.br/tests/hideout2325.xspf)”  
//constants  
DEFAULT\_PLAYLIST\_URL = “[http://hideout.com.br/shows/allshows.xspf](http://hideout.com.br/shows/allshows.xspf)”;  
DEFAULT\_WELCOME\_MSG = “Hideout XSPF Music Player - by Fabricio Zuardi”;  
LOADING\_PLAYLIST\_MSG = “Loading Playlist…”;  
DEFAULT\_LOADED\_PLAYLIST\_MSG = “- click to start”  
DEFAULT\_INFOBUTTON\_TXT = “Info”  
//playlists has priority over songs, if a playlist\_url parameter is found the song\_url is ignored  
//default playlist if none is passed through query string  
if(!playlist\_url){  
if(!song\_url){  
playlist\_url = DEFAULT\_PLAYLIST\_URL;  
}else{  
single\_music\_playlist = “\<?xml version=“1.0” encoding=“UTF-8”?\>\<playlist version=“1” xmlns = “\<A href=“[http://xspf.org/ns/0/"\>\<trackList"](http://xspf.org/ns/0/%22%3E%3CtrackList%22)\>[http://xspf.org/ns/0/"\>\<trackList\>";](http://xspf.org/ns/0/%22%3E%3CtrackList%3E%22;)  
single\_music\_playlist += “\<track\>\<location\>”+song\_url+”\</location\>\<annotation\>”+song\_title+”\</annotation\>\</track\>"  
single\_music\_playlist += “\</trackList\>\</playlist\>”  
}  
}  
info\_mc._visible=false;  
if(!info\_button\_text){  
info\_button\_text = DEFAULT\_INFOBUTTON\_TXT;  
}  
info\_mc.display\_txt.text = info\_button\_text;  
//variables initialization  
playlist\_array = [];  
track\_index = 0;  
playlist\_mc.track\_count = 0;  
pause\_position = 0;  
volume\_level = 100;  
playlist\_xml = new XML();  
playlist\_xml.ignoreWhite = true;  
playlist\_xml.onLoad = playlistLoaded;  
mysound = new Sound(this);  
playlist\_listener = new Object();  
playlist\_list.addEventListener(“change”, playlist\_listener)  
//play\_btn.onPress = playTrack;  
//functions  
//xml parser  
function playlistLoaded (success){  
if(success){  
var root\_node = this.firstChild;  
for(var node = root\_node.firstChild; node != null; node = node.nextSibling){  
if(node.nodeName == “title”){  
playlist\_title = node.firstChild.nodeValue;  
}  
if(node.nodeName == “trackList”){  
//tracks  
var tracks\_array = [];  
for(var track\_node = node.firstChild; track\_node != null; track\_node = track\_node.nextSibling){  
var track\_obj = new Object()  
//track attributes  
for(var track\_child = track\_node.firstChild; track\_child != null; track\_child = track\_child.nextSibling){  
if(track\_child.nodeName==“location”){  
track\_obj.location = track\_child.firstChild.nodeValue  
}  
if(track\_child.nodeName==“image”){  
track\_obj.image = track\_child.firstChild.nodeValue  
}  
if(track\_child.nodeName==“annotation”){  
track\_obj.annotation = track\_child.firstChild.nodeValue  
}  
if(track\_child.nodeName==“info”){  
track\_obj.info = track\_child.firstChild.nodeValue  
}  
}  
track\_obj.label = (tracks\_array.length+1) +". "+track\_obj.annotation;  
tracks\_array.push(track\_obj)  
addTrack(track\_obj.label);  
}  
}  
}  
playlist\_array = tracks\_array;  
if(!playlist\_size) playlist\_size = playlist\_array.length;  
playlist\_mc.tracks\_mc["track_"+track\_index+"\_mc"].bg\_mc.gotoAndStop(2)  
if(autoplay){  
loadTrack()  
}else{  
start\_btn\_mc.start\_btn.onPress = loadTrack;  
track\_display\_mc.display\_txt.text = playlist\_title+" “+DEFAULT\_LOADED\_PLAYLIST\_MSG;  
if(track\_display\_mc.display\_txt.\_width\>track\_display\_mc.mask\_mc.\_width){  
track\_display\_mc.onEnterFrame = scrollTitle;  
}else{  
track\_display\_mc.onEnterFrame = null;  
track\_display\_mc.display\_txt._x = 0;  
}  
}  
}else{  
annotation\_txt.text = "Error opening "+playlist\_url;  
}  
}  
playlist\_listener.change = function(eventObject){  
annotation\_txt.text = playlist\_list.selectedItem.annotation;  
location\_txt.text = playlist\_list.selectedItem.location;  
}  
function loadTrack(){  
//Radio Mode feature by nosferathoo, more info in: [https://sourceforge.net/tracker/index.php?func=detail&aid=1341940&group\_id=128363&atid=711474](https://sourceforge.net/tracker/index.php?func=detail&aid=1341940&group_id=128363&atid=711474)  
if (radio\_mode && track\_index==playlist\_size-1) {  
playlist\_url=playlist\_array[track\_index].location;  
for (i=0;i\<playlist\_mc.track\_count;++i) {  
removeMovieClip(playlist\_mc.tracks\_mc["track_”+i+"\_mc"]);  
}  
playlist\_mc.track\_count=0;  
playlist\_size=0;  
track\_index=0;  
autoload=true;  
autoplay=true;  
loadPlaylist();  
return(0);  
}

start\_btn\_mc.start\_btn.\_visible = false;  
track\_display\_mc.display\_txt.text = playlist\_array[track\_index].label;  
if(track\_display\_mc.display\_txt.\_width\>track\_display\_mc.mask\_mc.\_width){  
track\_display\_mc.onEnterFrame = scrollTitle;  
}else{  
track\_display\_mc.onEnterFrame = null;  
track\_display\_mc.display\_txt.\_x = 0;  
}  
cover\_mc.content\_mc[“photo”+last\_track\_index].removeMovieClip();  
mysound.loadSound(playlist\_array[track\_index].location,true);  
play\_mc.gotoAndStop(2)  
//image from playlist  
if(playlist\_array[track\_index].image!=undefined){  
cover\_mc.content\_mc.createEmptyMovieClip(“photo”+track\_index,track\_index)  
cover\_mc.content\_mc[“photo”+track\_index].loadMovie(playlist\_array[track\_index].image)  
}else{  
}  
//info button  
if(playlist\_array[track\_index].info!=undefined){  
info\_mc.\_visible = true;  
info\_mc.info\_btn.onPress = function(){  
getURL(playlist\_array[track\_index].info,"\_blank")  
}  
}else{  
info\_mc.\_visible = false;  
}  
\_root.onEnterFrame=function(){  
//HACK doesnt need to set the volume at every enterframe  
mysound.setVolume(this.volume\_level)  
var sound\_load\_percent = (mysound.getBytesLoaded()/mysound.getBytesTotal())\*100  
track\_display\_mc.loader\_mc.load\_bar\_mc.\_xscale = sound\_load\_percent;  
var image\_load\_percent = (cover\_mc.content\_mc[“photo”+track\_index].getBytesLoaded()/cover\_mc.content\_mc[“photo”+track\_index].getBytesTotal())\*100  
cover\_mc.load\_bar\_mc.\_xscale = image\_load\_percent;  
if((cover\_mc.content\_mc[“photo”+track\_index].getBytesLoaded()\>4)&&(image\_load\_percent==100)){  
//image loaded  
//make image fit  
cover\_mc.content\_mc[“photo”+track\_index].\_width = cover\_mc.load\_bar\_mc.\_width  
cover\_mc.content\_mc[“photo”+track\_index].\_height = cover\_mc.load\_bar\_mc.\_height  
}  
}  
}  
stop\_btn.onRelease = stopTrack;  
play\_mc.play\_btn.onRelease = playTrack  
next\_btn.onRelease = nextTrack  
prev\_btn.onRelease = prevTrack  
mysound.onSoundComplete = nextTrack;  
volume\_mc.volume\_btn.onPress = volumeChange;  
volume\_mc.volume\_btn.onRelease = volume\_mc.volume\_btn.onReleaseOutside = function(){  
this.\_parent.onMouseMove = this.\_parent.onMouseDown = null;  
}  
function volumeChange(){  
this.\_parent.onMouseMove = this.\_parent.onMouseDown = function(){  
var percent = (this.\_xmouse/this.\_width)\*100  
if(percent\>100)percent=100;  
if(percent\<0)percent=0;  
this.volume\_bar\_mc.\_xscale = percent  
this.\_parent.volume\_level = percent;  
mysound.setVolume(percent)  
}  
}  
function stopTrack() {  
mysound.stop();  
play\_mc.gotoAndStop(1)  
mysound.stop();  
mysound.start();  
mysound.stop();  
\_root.pause\_position = 0;

};  
function playTrack() {  
if(play\_mc.\_currentframe==1){ //play  
seekTrack(\_root.pause\_position)  
play\_mc.gotoAndStop(2)  
}else if(play\_mc.\_currentframe==2){  
\_root.pause\_position = mysound.position;  
mysound.stop();  
play\_mc.gotoAndStop(1)  
}

};  
function seekTrack(p\_offset:Number){  
mysound.stop()  
mysound.start(int((p\_offset)/1000),1)  
}  
function nextTrack(){  
if(track\_index\<playlist\_size-1){  
last\_track\_index = track\_index;  
track\_index ++;  
loadTrack();  
}else{  
if(repeat\_playlist){  
last\_track\_index = track\_index;  
track\_index = 0;  
loadTrack()  
}  
}  
playlist\_mc.tracks\_mc[“track\_”+last\_track\_index+“_mc"].bg\_mc.gotoAndStop(1)  
playlist\_mc.tracks\_mc["track_”+track\_index+“_mc"].bg\_mc.gotoAndStop(2)  
}  
function prevTrack(){  
if(track\_index\>0){  
last\_track\_index = track\_index;  
track\_index --;  
loadTrack();  
}  
playlist\_mc.tracks\_mc["track_”+last\_track\_index+“_mc"].bg\_mc.gotoAndStop(1)  
playlist\_mc.tracks\_mc["track_”+track\_index+"\_mc"].bg\_mc.gotoAndStop(2)  
}  
function scrollTitle(){  
track\_display\_mc.display\_txt.\_x -= 5;  
if (track\_display\_mc.display\_txt.\_x+track\_display\_mc.display\_txt.\_width\<0){  
track\_display\_mc.display\_txt.\_x = track\_display\_mc.mask\_mc.\_width;  
}  
}  
function resizeUI(){  
bg\_mc.\_width = Stage.width;  
track\_display\_mc.loader\_mc.\_width = Stage.width - track\_display\_mc.\_x - 3;  
track\_display\_mc.mask\_mc.\_width = track\_display\_mc.loader\_mc.\_width - 26;  
if(track\_display\_mc.display\_txt.\_width\>track\_display\_mc.mask\_mc.\_width){  
track\_display\_mc.onEnterFrame = scrollTitle;  
}else{  
track\_display\_mc.onEnterFrame = null;  
track\_display\_mc.display\_txt.\_x = 0;  
}  
volume\_mc.\_x = Stage.width - 22;  
start\_btn\_mc.\_xscale = Stage.width;  
//playlist area tinnier that the album cover  
if(Stage.width\<2.5_cover\_mc.\_width){  
//  
if (Stage.height\>2.5_cover\_mc.\_height){  
//send album cover to bottom  
cover\_mc.\_y = Stage.height - cover\_mc.\_height -2- info\_mc.\_height -2;  
info\_mc.\_y = Stage.height - info\_mc.\_height -2;  
var covervisible =1;  
}else{  
var covervisible =0;  
//hide album cover  
cover\_mc.\_y = Stage.height;  
}  
//send playlist to left  
playlist\_mc.\_x = cover\_mc.\_x;  
scrollbar\_mc.bg\_mc.\_height = Stage.height - (19+(cover\_mc.\_height+info\_mc.\_height+4)\*covervisible);  
playlist\_mc.bg\_mc.\_height = Stage.height - (19+(cover\_mc.\_height+info\_mc.\_height+4)\*covervisible);  
playlist\_mc.mask\_mc.\_height = Stage.height - (23+(cover\_mc.\_height+info\_mc._height+4)covervisible);  
}else{  
cover\_mc.\_y = 17;  
info\_mc.\_y = 153;  
playlist\_mc.\_x = 138;  
scrollbar\_mc.bg\_mc.\_height = Stage.height -19;  
playlist\_mc.bg\_mc.\_height = Stage.height - 19;  
playlist\_mc.mask\_mc.\_height = Stage.height - 23;  
}  
scrollbar\_mc.\_x = Stage.width - 12;  
playlist\_mc.mask\_mc.\_width = Stage.width - (playlist\_mc.\_x + 19);  
playlist\_mc.bg\_mc.\_width = Stage.width - (playlist\_mc.x + 14);  
}  
function addTrack(track\_label){  
if(playlist\_mc.track\_count\>0) {  
playlist\_mc.tracks\_mc.track\_0\_mc.duplicateMovieClip("track"+playlist\_mc.track\_count+“mc",playlist\_mc.track\_count);  
}  
playlist\_mc.tracks\_mc["track”+playlist\_mc.track\_count+"\_mc"].\_y += playlist\_mc.track\_count14;  
playlist\_mc.tracks\_mc["track_"+playlist\_mc.track\_count+“_mc"].display\_txt.autoSize = “left”;  
playlist\_mc.tracks\_mc["track_”+playlist\_mc.track\_count+“_mc"].display\_txt.text = track\_label;  
playlist\_mc.tracks\_mc["track_”+playlist\_mc.track\_count+“_mc"].bg\_mc.index = playlist\_mc.track\_count;  
playlist\_mc.tracks\_mc["track_”+playlist\_mc.track\_count+“_mc"].bg\_mc.select\_btn.onPress = function(){  
last\_track\_index = track\_index;  
playlist\_mc.tracks\_mc["track_”+track\_index+"\_mc"].bg\_mc.gotoAndStop(1)  
track\_index = this._parent.index;  
playlist\_mc.tracks\_mc["track_"+track\_index+"\_mc"].bg\_mc.gotoAndStop(2)  
loadTrack();  
}  
playlist\_mc.track\_count ++;  
}  
//scroll  
scrollbar\_mc.up\_btn.onPress = function(){  
this.\_parent.v = -1;  
this.\_parent.onEnterFrame = scrollTracks;  
}  
scrollbar\_mc.down\_btn.onPress = function(){  
this.\_parent.v = 1;  
this.\_parent.onEnterFrame = scrollTracks;  
}  
scrollbar\_mc.up\_btn.onRelease = scrollbar\_mc.down\_btn.onRelease = function(){  
this.\_parent.onEnterFrame = null;  
}  
scrollbar\_mc.handler\_mc.drag\_btn.onPress = function(){  
var scroll\_top\_limit = 19;  
var scroll\_bottom\_limit = scrollbar\_mc.bg\_mc.\_height - scrollbar\_mc.handler\_mc.\_height - 2;  
this.\_parent.startDrag(false,this.\_parent.\_x,scroll\_top\_limit,this.\_parent.\_x,scroll\_bottom\_limit)  
this.\_parent.isdragging = true;  
this.\_parent.onEnterFrame = scrollTracks;  
}  
scrollbar\_mc.handler\_mc.drag\_btn.onRelease = scrollbar\_mc.handler\_mc.drag\_btn.onReleaseOutside = function(){  
stopDrag()  
this.\_parent.isdragging = false;  
this.\_parent.onEnterFrame = null;  
}  
function scrollTracks(){  
var scroll\_top\_limit = 19;  
var scroll\_bottom\_limit = scrollbar\_mc.bg\_mc.\_height - scrollbar\_mc.handler\_mc.\_height - 2;  
var list\_bottom\_limit = 1;  
var list\_top\_limit = (1-Math.round(playlist\_mc.tracks\_mc.\_height))+Math.floor(playlist\_mc.mask\_mc.\_height/14)_14  
if(playlist\_mc.tracks\_mc.\_height\>playlist\_mc.mask\_mc.\_height){  
if(scrollbar\_mc.handler\_mc.isdragging){  
var percent = (scrollbar\_mc.handler\_mc.\_y-scroll\_top\_limit)/(scroll\_bottom\_limit-scroll\_top\_limit)  
playlist\_mc.tracks\_mc.\_y = (list\_top\_limit-list\_bottom\_limit)percent+list\_bottom\_limit;  
}else{  
if(scrollbar\_mc.v==-1){  
if(playlist\_mc.tracks\_mc.\_y+14\<list\_bottom\_limit){  
playlist\_mc.tracks\_mc.\_y += 14;  
}else{  
playlist\_mc.tracks\_mc.\_y = list\_bottom\_limit;  
}  
var percent = (playlist\_mc.tracks\_mc.\_y-1)/(list\_top\_limit-1)  
scrollbar\_mc.handler\_mc.\_y = percent(scroll\_bottom\_limit - scroll\_top\_limit)+scroll\_top\_limit;  
}else if(scrollbar\_mc.v==1){  
if(playlist\_mc.tracks\_mc.\_y-14\>list\_top\_limit){  
playlist\_mc.tracks\_mc.\_y -= 14;  
}else{  
playlist\_mc.tracks\_mc.\_y = list\_top\_limit;  
}  
var percent = (playlist\_mc.tracks\_mc.\_y-1)/(list\_top\_limit-1)  
scrollbar\_mc.handler\_mc.\_y = percent_(scroll\_bottom\_limit - scroll\_top\_limit)+scroll\_top\_limit;  
}  
}  
}  
}  
function loadPlaylist(){  
track\_display\_mc.display\_txt.text = LOADING\_PLAYLIST\_MSG;  
if(track\_display\_mc.display\_txt.\_width\>track\_display\_mc.mask\_mc.\_width){  
track\_display\_mc.onEnterFrame = scrollTitle;  
}else{  
track\_display\_mc.onEnterFrame = null;  
track\_display\_mc.display\_txt.\_x = 0;  
}  
//playlist  
if(playlist\_url){  
playlist\_xml.load(unescape(playlist\_url))  
}else{  
//single track  
playlist\_xml.parseXML(single\_music\_playlist)  
playlist\_xml.onLoad(true);  
}  
}  
//first click - load playlist  
start\_btn\_mc.start\_btn.onPress = function(){  
autoplay = true;  
loadPlaylist();  
}

//main  
Stage.scaleMode = “noScale”  
Stage.align = “LT”;  
this.onResize = resizeUI;  
Stage.addListener(this);  
if(!player\_title) player\_title = DEFAULT\_WELCOME\_MSG;  
track\_display\_mc.display\_txt.autoSize = “left”;  
track\_display\_mc.display\_txt.text = player\_title;  
if(track\_display\_mc.display\_txt.\_width\>track\_display\_mc.mask\_mc.\_width){  
track\_display\_mc.onEnterFrame = scrollTitle;  
}else{  
track\_display\_mc.onEnterFrame = null;  
track\_display\_mc.display\_txt.\_x = 0;  
}  
//start to play automatically if parameter autoplay is present  
if(autoplay){  
start\_btn\_mc.start\_btn.onPress();  
} else if (autoload){  
loadPlaylist()  
}  
//customized menu  
var my\_cm:ContextMenu = new ContextMenu();  
my\_cm.customItems.push(new ContextMenuItem(“Stop”, stopTrack));  
my\_cm.customItems.push(new ContextMenuItem(“Play!”, playTrack));  
my\_cm.customItems.push(new ContextMenuItem(“Next”, nextTrack));  
my\_cm.customItems.push(new ContextMenuItem(“Previous”, prevTrack));  
my\_cm.customItems.push(new ContextMenuItem(“Download this song”, function(){getURL(playlist\_array[track\_index].location,"\_blank")},true));  
my\_cm.customItems.push(new ContextMenuItem(“Add song to Webjay playlist”, function(){getURL(“[http://webjay.org/poster?media="+escape(playlist\_array[track\_index].location),"\_blank](http://webjay.org/poster?media=)”)}));  
my\_cm.customItems.push(new ContextMenuItem(“About Hideout”, function(){getURL("\<A href=“[http://www.hideout.com.br](http://www.hideout.com.br)”,"\_blank")},true"\>[http://www.hideout.com.br](http://www.hideout.com.br)","\_blank")},true));  
//my\_cm.customItems.push(new ContextMenuItem(“Crossfade”, function(){}));  
//my\_cm.customItems.push(new ContextMenuItem(“Mando Diao - Paralyzed”, function(){}));  
my\_cm.hideBuiltInItems();  
this.menu = my\_cm;  
resizeUI();
