Hi to all I got flash mp3 player from my friend and I wanna your help becuase I'm not well flash and my friend was moved to Africa, here the actionscripts 2.0 code.
my question is I don't to use the plalist.xml file I want to use direct link in the embed code
( name=flashvar value="xmlurl=song.mp3-- to value="mp3=http://mysite.com/song.mp3 instead"
player.fla
player.swf
playlist.xml
stop();
var songs:Array = new Array();
var curtrack:Number = 0;
var playingsong:Sound = new Sound();
var _play:Boolean = false;
var playlistXml:XML = new XML();
if (_level0.xmlURL == undefined)
{
xmlURL = _level0.xmlURL;
}
else
{
xmlURL = _level0.xmlURL;
}
playlistXml.ignoreWhite = true;
playlistXml.load(xmlURL);
indicator.gotoAndStop(1);
progressslider._visible = false;
songtime._visible = false;
songtime_2._visible = false;
playpause.playpausebutton.onPress = function()
{
load_song();
};
function load_song()
{
loadSongs();
loadSong(curtrack);
_play = true;
progressslider._visible = true;
indicator.play();
songtime._visible = true;
songtime_2._visible = true;
}
function loadSongs()
{
for (songIndex = 0; songIndex < playlistXml.childNodes[0].childNodes[0].childNodes.length; songIndex++)
{
var songdata:Object = new Object();
for (songNode = 0; songNode < playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes.length; songNode++)
{
switch (playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].nodeName)
{
case "creator" :
songdata.artist = playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].childNodes[0].nodeValue;
break;
case "title" :
songdata.title = playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].childNodes[0].nodeValue;
break;
case "location" :
songdata.location = playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].childNodes[0].nodeValue;
break;
}
}
songs[songIndex] = songdata;
}
}
function loadSong(track)
{
playingsong = new Sound();
playingsong.loadSound(songs[track].location,true);
playingsong.start();
updatevolume();
playingsong.onSoundComplete = function()
{
playpause.gotoAndStop(1);
indicator.gotoAndStop(1);
playpause.playpausebutton.onPress = function()
{
loadSongs();
loadSong(curtrack);
};
};
playpause.gotoAndStop(2);
indicator.play();
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
songdisplay.text = songs[track].artist + " - " + songs[track].title;
eval("playlistbox.playlistitemcontainer.playlistitem" + curtrack + ".playlistitemhighlight")._alpha = 4;
eval("playlistbox.playlistitemcontainer.playlistitem" + track + ".playlistitemhighlight")._alpha = 20;
curtrack = track;
}
function toggleplaypause()
{
if (playpause._currentframe == 1)
{
playpause.gotoAndStop(2);
playpause.curpos = playingsong.position;
playingsong.start(playpause.curpos / 1000,0);
indicator.play();
}
else
{
playpause.gotoAndStop(1);
playingsong.stop();
indicator.stop();
}
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
}
onEnterFrame = function ()
{
if (!draggingslider)
{
progressslider._x = (playingsong.position / playingsong.duration) * 249 + 130;
if (progressslider._x == 0)
{
progressslider._x = 130;
}
}
if (draggingvolmeslider)
{
updatevolume();
}
tempsongtime = "";
if (Math.floor(playingsong.position / 60000) == 0)
{
tempsongtime += "0";
}
else
{
tempsongtime += Math.floor(playingsong.position / 60000);
}
tempsongtime += ":";
if (Math.floor((playingsong.position / 1000) % 60) < 10)
{
tempsongtime += "0";
}
tempsongtime += Math.floor((playingsong.position / 1000) % 60);
tempsongtime += " ";
if (Math.floor(playingsong.duration / 60000) == 0)
{
tempsongtime += "0";
}
else
{
tempsongtime += Math.floor(playingsong.duration / 60000);
}
tempsongtime += ":";
if (Math.floor((playingsong.duration / 1000) % 60) < 10)
{
tempsongtime += "0";
}
tempsongtime += Math.floor((playingsong.duration / 1000) % 60);
songtime.text = tempsongtime;
tempsongtime_2 = "";
tempsongtime_2 += "";
if (Math.floor(playingsong.duration / 60000) == 0)
{
tempsongtime_2 += "0";
}
else
{
tempsongtime_2 += Math.floor(playingsong.duration / 60000);
}
tempsongtime_2 += ":";
if (Math.floor((playingsong.duration / 1000) % 60) < 10)
{
tempsongtime_2 += "0";
}
tempsongtime_2 += Math.floor((playingsong.duration / 1000) % 60);
songtime_2.text = tempsongtime_2;
};
progressslider.onPress = function()
{
draggingslider = true;
progressslider.startDrag(true,130,progressslider._y,374,progressslider._y);
};
progressslider.onRelease = progressslider.onReleaseOutside = function ()
{
if (_play)
{
progressslider.stopDrag();
playingsong.start(((progressslider._x - 130) / 249) * playingsong.duration / 1000,0);
playpause.gotoAndStop(2);
indicator.play();
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
draggingslider = false;
}
};
progressbar.onPress = function()
{
if (_play)
{
playingsong.start(((_xmouse - 130) / 249) * playingsong.duration / 1000,0);
playpause.gotoAndStop(2);
indicator.play();
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
}
};
volumebar.onPress = function()
{
draggingvolmeslider = true;
volumebar.volumeslider.startDrag(true,0,volumebar.volumeslider._y,47,volumebar.volumeslider._y);
};
volumebar.onRelease = volumebar.onReleaseOutside = function ()
{
draggingvolmeslider = false;
volumebar.volumeslider.stopDrag();
updatevolume();
};
function updatevolume()
{
playingsong.setVolume((volumebar.volumeslider._x / 47) * 100);
}stop();
var songs:Array = new Array();
var curtrack:Number = 0;
var playingsong:Sound = new Sound();
var _play:Boolean = false;
var playlistXml:XML = new XML();
if (_level0.xmlURL == undefined)
{
xmlURL = _level0.xmlURL;
}
else
{
xmlURL = _level0.xmlURL;
}
playlistXml.ignoreWhite = true;
playlistXml.load(xmlURL);
indicator.gotoAndStop(1);
progressslider._visible = false;
songtime._visible = false;
songtime_2._visible = false;
playpause.playpausebutton.onPress = function()
{
load_song();
};
function load_song()
{
loadSongs();
loadSong(curtrack);
_play = true;
progressslider._visible = true;
indicator.play();
songtime._visible = true;
songtime_2._visible = true;
}
function loadSongs()
{
for (songIndex = 0; songIndex < playlistXml.childNodes[0].childNodes[0].childNodes.length; songIndex++)
{
var songdata:Object = new Object();
for (songNode = 0; songNode < playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes.length; songNode++)
{
switch (playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].nodeName)
{
case "creator" :
songdata.artist = playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].childNodes[0].nodeValue;
break;
case "title" :
songdata.title = playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].childNodes[0].nodeValue;
break;
case "location" :
songdata.location = playlistXml.childNodes[0].childNodes[0].childNodes[songIndex].childNodes[songNode].childNodes[0].nodeValue;
break;
}
}
songs[songIndex] = songdata;
}
}
function loadSong(track)
{
playingsong = new Sound();
playingsong.loadSound(songs[track].location,true);
playingsong.start();
updatevolume();
playingsong.onSoundComplete = function()
{
playpause.gotoAndStop(1);
indicator.gotoAndStop(1);
playpause.playpausebutton.onPress = function()
{
loadSongs();
loadSong(curtrack);
};
};
playpause.gotoAndStop(2);
indicator.play();
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
songdisplay.text = songs[track].artist + " - " + songs[track].title;
eval("playlistbox.playlistitemcontainer.playlistitem" + curtrack + ".playlistitemhighlight")._alpha = 4;
eval("playlistbox.playlistitemcontainer.playlistitem" + track + ".playlistitemhighlight")._alpha = 20;
curtrack = track;
}
function toggleplaypause()
{
if (playpause._currentframe == 1)
{
playpause.gotoAndStop(2);
playpause.curpos = playingsong.position;
playingsong.start(playpause.curpos / 1000,0);
indicator.play();
}
else
{
playpause.gotoAndStop(1);
playingsong.stop();
indicator.stop();
}
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
}
onEnterFrame = function ()
{
if (!draggingslider)
{
progressslider._x = (playingsong.position / playingsong.duration) * 249 + 130;
if (progressslider._x == 0)
{
progressslider._x = 130;
}
}
if (draggingvolmeslider)
{
updatevolume();
}
tempsongtime = "";
if (Math.floor(playingsong.position / 60000) == 0)
{
tempsongtime += "0";
}
else
{
tempsongtime += Math.floor(playingsong.position / 60000);
}
tempsongtime += ":";
if (Math.floor((playingsong.position / 1000) % 60) < 10)
{
tempsongtime += "0";
}
tempsongtime += Math.floor((playingsong.position / 1000) % 60);
tempsongtime += " ";
if (Math.floor(playingsong.duration / 60000) == 0)
{
tempsongtime += "0";
}
else
{
tempsongtime += Math.floor(playingsong.duration / 60000);
}
tempsongtime += ":";
if (Math.floor((playingsong.duration / 1000) % 60) < 10)
{
tempsongtime += "0";
}
tempsongtime += Math.floor((playingsong.duration / 1000) % 60);
songtime.text = tempsongtime;
tempsongtime_2 = "";
tempsongtime_2 += "";
if (Math.floor(playingsong.duration / 60000) == 0)
{
tempsongtime_2 += "0";
}
else
{
tempsongtime_2 += Math.floor(playingsong.duration / 60000);
}
tempsongtime_2 += ":";
if (Math.floor((playingsong.duration / 1000) % 60) < 10)
{
tempsongtime_2 += "0";
}
tempsongtime_2 += Math.floor((playingsong.duration / 1000) % 60);
songtime_2.text = tempsongtime_2;
};
progressslider.onPress = function()
{
draggingslider = true;
progressslider.startDrag(true,130,progressslider._y,374,progressslider._y);
};
progressslider.onRelease = progressslider.onReleaseOutside = function ()
{
if (_play)
{
progressslider.stopDrag();
playingsong.start(((progressslider._x - 130) / 249) * playingsong.duration / 1000,0);
playpause.gotoAndStop(2);
indicator.play();
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
draggingslider = false;
}
};
progressbar.onPress = function()
{
if (_play)
{
playingsong.start(((_xmouse - 130) / 249) * playingsong.duration / 1000,0);
playpause.gotoAndStop(2);
indicator.play();
playpause.playpausebutton.onPress = function()
{
toggleplaypause();
};
}
};
volumebar.onPress = function()
{
draggingvolmeslider = true;
volumebar.volumeslider.startDrag(true,0,volumebar.volumeslider._y,47,volumebar.volumeslider._y);
};
volumebar.onRelease = volumebar.onReleaseOutside = function ()
{
draggingvolmeslider = false;
volumebar.volumeslider.stopDrag();
updatevolume();
};
function updatevolume()
{
playingsong.setVolume((volumebar.volumeslider._x / 47) * 100);
}
I hope you understand my question and will help me