Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-10-2004, 08:03 PM
Junior Member
 
Join Date: Jan 2003
Posts: 12
Default setInterval Bug

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.
Reply With Quote
  #2 (permalink)  
Old 05-11-2004, 12:31 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:setInterval Bug

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.
Reply With Quote
  #3 (permalink)  
Old 05-11-2004, 12:47 PM
Junior Member
 
Join Date: Jan 2003
Posts: 12
Default Re:setInterval Bug

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.
Reply With Quote
  #4 (permalink)  
Old 05-11-2004, 11:26 PM
Junior Member
 
Join Date: Feb 2003
Posts: 12
Default Re:setInterval Bug

Quote:
var nInterval = nAverageAnswerTime*1000;
with this formula, if nAverageAnswerTime is set to 750, the value of nInterval becomes 750000 which equates to 12.5 minutes.

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);
Reply With Quote
  #5 (permalink)  
Old 05-12-2004, 12:16 PM
Junior Member
 
Join Date: Jan 2003
Posts: 12
Default Re:setInterval Bug

nAverageTime was NOT equal to 750. It was equal to .75
Reply With Quote
  #6 (permalink)  
Old 05-12-2004, 12:35 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:setInterval Bug

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);
We will fix it in the next version.
Reply With Quote
  #7 (permalink)  
Old 02-19-2008, 01:17 PM
Junior Member
 
Join Date: Jan 2008
Posts: 4
Default Re: setInterval Bug

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);
Only the following code may work:
Code:
var l__time = parseInt(Math.floor(10000*Math.random()).toString());
var l__timer = Application.setInterval(myfunction, l__time);
Reply With Quote
  #8 (permalink)  
Old 02-28-2008, 01:53 PM
Junior Member
 
Join Date: Feb 2008
Posts: 7
Default Re: setInterval Bug

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:
  • Add a pop-up reminder to my desktop SWF application
  • Track the date and time (for reporting purposes) when the reminder was activated

So, for what it's worth, thank you very much!
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:22 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.