nate51
05-16-2008, 09:33 PM
I have an XML run MP3 player on my site and for some wierd reason when I play it off my desktop (the site that is) it all works fine, when I made a sub directory on my server, still worked fine then when I uploaded everything to the main directory to go live, the player has a progress bar for the track that fills too fast when it's playing and the song gets cut off then it jumps to the next song, like it believes the song is over.
This is the AS I have on the player.
function reposition() {
var playermc = _root.player;
var nPos;
nPos = getNewPosition(playermc);
playermc._x = 0;
playermc._y = Stage.height - playermc._height;
};
function getNewPosition(mc) {
var newX = Math.floor((Stage.width - mc._width) / 2);
var newY = Math.floor((Stage.height - mc._height) / 2);
return {x:newX, y:newY};
};
reposition();
function convertXML():Object
{
//Defines the object used to store all track information from the XML file
var tracksData = {};
tracksData.titles = new Array();
tracksData.artists = new Array();
tracksData.urls = new Array();
//The base node has been set to a variable to shorten code and make
//things easier when modifying.
var tracks = xml.firstChild.childNodes;
//I've set the number of tracks specified in the XML file to a variable to
//save Flash the trouble of looking this number up everytime the for loop
//is executed. This technique can save a bit of time with big loops.
var tracksCount = tracks.length;
for(var i = 0; i < tracksCount; i++)
{
//Appends the node values of each category to the tracksData object
//in the relative category/array.
tracksData.titles.push(tracks[i].childNodes[0].firstChild.nodeValue);
tracksData.artists.push(tracks[i].childNodes[1].firstChild.nodeValue);
tracksData.urls.push(tracks[i].childNodes[2].firstChild.nodeValue);
}
return tracksData;
}
var xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success:Boolean)
{
if(success)
{
var player = new MusicPlayer(player, convertXML(), this.firstChild.attributes.initTrackID);
}
else
{
trace("Unable to load XML.");
}
}
//Begins loading XML
xml.load("tracks.xml");
stop();
I am stumped on this, does anyone see any errors in the code that may be causing this?
-- Nate
This is the AS I have on the player.
function reposition() {
var playermc = _root.player;
var nPos;
nPos = getNewPosition(playermc);
playermc._x = 0;
playermc._y = Stage.height - playermc._height;
};
function getNewPosition(mc) {
var newX = Math.floor((Stage.width - mc._width) / 2);
var newY = Math.floor((Stage.height - mc._height) / 2);
return {x:newX, y:newY};
};
reposition();
function convertXML():Object
{
//Defines the object used to store all track information from the XML file
var tracksData = {};
tracksData.titles = new Array();
tracksData.artists = new Array();
tracksData.urls = new Array();
//The base node has been set to a variable to shorten code and make
//things easier when modifying.
var tracks = xml.firstChild.childNodes;
//I've set the number of tracks specified in the XML file to a variable to
//save Flash the trouble of looking this number up everytime the for loop
//is executed. This technique can save a bit of time with big loops.
var tracksCount = tracks.length;
for(var i = 0; i < tracksCount; i++)
{
//Appends the node values of each category to the tracksData object
//in the relative category/array.
tracksData.titles.push(tracks[i].childNodes[0].firstChild.nodeValue);
tracksData.artists.push(tracks[i].childNodes[1].firstChild.nodeValue);
tracksData.urls.push(tracks[i].childNodes[2].firstChild.nodeValue);
}
return tracksData;
}
var xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(success:Boolean)
{
if(success)
{
var player = new MusicPlayer(player, convertXML(), this.firstChild.attributes.initTrackID);
}
else
{
trace("Unable to load XML.");
}
}
//Begins loading XML
xml.load("tracks.xml");
stop();
I am stumped on this, does anyone see any errors in the code that may be causing this?
-- Nate