Hi.
I’m getting and parsing a json feed for an online radio station.
The json feed gives me played and left time and pecentage of the song progress etc.
The problem is, that i can successfully display everything i need, but the problem happens when the song finishes.
i’m using setInterval to take off a second in ‘remaining time’ text box, and i need it to refresh, after one song is finished, but it doesn’t, it just goes into a negative value.
the code for left time:
function rem (){
var aegj:String = seconds2time(left--); //this is a custom function for converting seconds into mm:ss
aeg.text = "-"+aegj;
if(left == 0){
jsonFetcher.load("my_json_feed.php");
};
};
it should just refresh the variables, right? but why doesn’t it do so?
some code in jsonFetcher.onData:
jsonFetcher.onData = function(thedata) {
try {
var json = new JSON();
var o:Object = json.parse(thedata);
_global.left = o.nowplaying.length - o.nowplaying.played;
//etc
Help, please!!