Hi! Im having some problems with this function. When I run it, I get an error saying my computer may become unresponsive if the script continues to run.
What's really weird is that "trace(comments);" runs (although it doesn't actually trace the comments, just whitespace).
Any idea what could be causing this?
Thanks in advance
Code:
function loadComments(){
var comments_lv:LoadVars = new LoadVars();
for(i=0; i < torrentList.length; i++){
comments_lv.load(torrentList[i]);
comments_lv.onData = function(data){
index1 = data.indexOf("CET",0);
for(a = 0; a != index1 || a == 1; a++){
index2 = data.indexOf("CET",index2+3);
commentDate = data.substr(index2-17,10);
commentDate.split("-");
comment = new Date(commentDate[0],commentDate[1],commentDate[2]);
var today_date:Date = new Date();
var currentDate:Date = new Date(today_date.getFullYear(),today_date.getMonth(),today_date.getDate());
msecs = currentDate - comment;
oneDay = 60*60*24*1000;
diff = int(msecs/oneDay);
if(diff <= maxDiff){
index3 = data.indexOf('class="comment">',index2);
index4 = data.indexOf("</div>",index3);
comments[a] = data.substr(index3+17,index3+17-index2);
comments_link[a] = torrentList[i];
}
}
}
}
trace(comments);
}