
Welcome Guest
|
#1
|
|||
|
|||
|
setinterval resetting before loop completes
I've got a timer set up using setInterval. The function clears the interval id, attempts to execute and then resets the interval. The problem is that it isn't executing all of the code before the timer is reset:
Code:
function readDB():Void
{
clearInterval(intervalId)
trace("--clearIntervalId")
trace("polling db " + myArray.length)
for (var i:Number = 0 ; i < myArray.length; i++)
{
var url:String = dbPath + "readData.asp"
trace(i + " reading")
var allData:LoadVars = new LoadVars()
allData.myLetter = myArray[i].ID
allData.sendAndLoad(url, allData, "POST")
allData.onLoad = function(success:Boolean)
{
trace("allData returned: " + success)
if (success)
trace("DB returns " + this['ID'])
}
}
intervalId = setInterval(readDB, 1000)
trace("--setIntervalId\n")
}--clearIntervalID polling db 4 0 reading 1 reading 2 reading 3 reading --setIntervalId 1 allData returned: true DB returns id1 allData returned: true DB returns id2 allData returned: true DB returns id3 allData returned: true DB returns id4 --clearIntervalID polling db id4 0 reading 1 reading 2 reading 3 reading --setIntervalId 2 allData returned: true DB returns id1 allData returned: true DB returns id2 allData returned: true DB returns id3 allData returned: true DB returns id4 |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can I loop last 75% of swf a few times then loop the whole swf? | mafadecay | General Flash | 0 | 05-24-2011 10:36 PM |
| video won't loop | odaat | Newbies |
1 | 11-17-2007 08:33 PM |
| How to loop a movie clip? | golferstud84 | Flash MX |
1 | 11-17-2005 04:30 AM |
| Resolved: sound loop button | juury | Newbies |
2 | 03-08-2004 04:49 AM |
| Resolved: sound loop problems | juury | Flash MX |
2 | 03-07-2004 08:13 AM |




