Hi!
I have created a song player, It is working fine on local machine but its not working on live site. Here is the code.
// Playlist Arrays…
var songFile:Array = new Array();
var songArtist:Array = new Array();
var songName:Array = new Array();
var currentSong:Number = 0;
var songCount:Number = 0;
var songMuted:Boolean = true;
var songVolume:Number = 100;
// Song Object…
var songObject:Sound = new Sound();
// Playlist XML Import…
var xmlData:XML = new XML();
xmlData.ignoreWhite = true;
xmlFile = “_ambiance.xml”;
xmlData.load(xmlFile);
xmlData.onLoad = function(xmlSuccess:Boolean) {
if (xmlSuccess) {
topNode = this.firstChild;
songCount = topNode.childNodes.length;
for (i=0; i<songCount; i++) {
songFile* = topNode.childNodes*.childNodes[0].firstChild.nodeValue;
songArtist* = topNode.childNodes*.childNodes[1].firstChild.nodeValue;
songName* = topNode.childNodes*.childNodes[2].firstChild.nodeValue;
if (i == 0) {
loadSong(i);
}
}
}
};
function loadSong(inTrack) {
songObject.stop();
songObject = new Sound();
songObject.loadSound(songFile[inTrack], true);
txtArtist.text = songArtist[inTrack];
txtName.text = songName[inTrack];
songVolume = 0;
}
back_btn.onPress = function() {
currentSong>0 ? currentSong-- : currentSong=songCount-1;
loadSong(currentSong);
};
next_btn.onPress = function() {
currentSong<songCount-1 ? currentSong++ : currentSong=0;
loadSong(currentSong);
};
toggle_btn.onPress = function() {
songMuted ? songMuted=false : songMuted=true;
};
onEnterFrame = function () {
// Fade Effect…
if (songMuted) {
headphones_mc.nextFrame();
songVolume>0 ? songVolume -= 10 : songVolume=0;
} else {
headphones_mc.prevFrame();
songVolume<100 ? songVolume += 10 : songVolume=100;
}
// Set Volume…
songObject.setVolume(songVolume);
// Loader Bar…
progress_mc._xscale = (100/songObject.getBytesTotal())*songObject.getBytesLoaded();
// Playlist Looping…
if (songObject.position == songObject.duration && songObject.getBytesTotal() == songObject.getBytesLoaded() && songObject.getBytesTotal()>10) {
currentSong<songCount-1 ? currentSong++ : currentSong=0;
loadSong(currentSong);
}
};
Any body please help me.