|
|||
|
Hello,
I have discovered the following bug: When calling setInterval(functionName, interval) and using a variable for the argument of "interval", the function specified by functionName is never called. For example, the following code fails: var nInterval = nAverageAnswerTime*1000; intervalUpdateDemoScores = Application.setInterval(updateDemoScores, nInterval); And the following code functions properly: intervalUpdateDemoScores = Application.setInterval(updateDemoScores, 750); Please advise me of how to work around this bug. Thank you. |
|
|||
|
If the "nAverageAnswerTime" is too big, the method won't be called for a long time.
If nAverageAnswerTime equals to 750, the interval is 12.5 minutes. Please set the value of nAverageAnswerTime to 1 and try again. |
|
|||
|
The SWFKit Help specifies that the interval parameter is "The time in milliseconds between calls to the function or method." Therefore, an interval of 750 should be 1/4 second. When I hard-code the value as 750, the function is called every 1/4 second. I have done extensive testing to prove this. If you still believe I am incorrect, please post an example file to show me what I am doing incorrectly. Thank you.
|
|
|||
|
Quote:
Not sure where or what nAverageAnswerTime is set to prior to the snippet that was posted. the following works in pro 2.1 r2. Code:
var nAverageAnswerTime=2;
var nInterval = nAverageAnswerTime*1000;
function updateDemoScores()
{
Dialogs.msgBox("test");
}
intervalUpdateDemoScores = Application.setInterval(updateDemoScores, nInterval);
|
|
|||
|
The setInterval method can only take a integer parameter.
The following code will work Code:
var nInterval = nAverageAnswerTime*1000; nInterval = parseInt(nInterval.toString()); intervalUpdateDemoScores = Application.setInterval(updateDemoScores, nInterval); |
|
|||
|
The issue still exists on Pro 3.2 when trying something like that:
Code:
var l__time = Math.floor(10000*Math.random()); var l__timer = Application.setInterval(myfunction, l__time); Code:
var l__time = parseInt(Math.floor(10000*Math.random()).toString()); var l__timer = Application.setInterval(myfunction, l__time); |
|
|||
|
Thank you!
Of course, as a newbie, I'm not sure what specific bugs and issues everyone else is experiencing, but I justed wanted to thank everyone who has posted in this thread. Thanks to all the comments and code snippets, I've been able to accomplish the following in SWFKit:
So, for what it's worth, thank you very much! |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|