Re: [Flashcoders] setInterval() and the trouble
Eric E. Dolecki wrote: use setTimeout now and you dont need to worry about interval ids. e.dolecki Have you found any documentation about setTimeout - because I haven't : ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] setInterval() and the trouble
Its undocumented, but it works in a fire once kind of situation like javascript: foo = setTimeout( func, ms) clearTimeout(foo) but only if you need to stop the interval. Otherwise, just fire it and forget it. e.d. On 10/30/05, Kent Humphrey [EMAIL PROTECTED] wrote: Eric E. Dolecki wrote: use setTimeout now and you dont need to worry about interval ids. e.dolecki Have you found any documentation about setTimeout - because I haven't : ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] setInterval() and the trouble
Why is something so useful undocumented? I have to bend over backwards to create single-fire timers. Thanks for the post. -Original Message- Its undocumented, but it works in a fire once kind of situation like javascript: foo = setTimeout( func, ms) clearTimeout(foo) but only if you need to stop the interval. Otherwise, just fire it and forget it. e.d. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] setInterval() and the trouble
Not sure, but it's in the new ActionScript 2.0 Language Reference for Flash Player 8. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Beynart Sent: Sunday, October 30, 2005 2:59 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] setInterval() and the trouble Why is something so useful undocumented? I have to bend over backwards to create single-fire timers. Thanks for the post. -Original Message- Its undocumented, but it works in a fire once kind of situation like javascript: foo = setTimeout( func, ms) clearTimeout(foo) but only if you need to stop the interval. Otherwise, just fire it and forget it. e.d. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] setInterval() and the trouble
perhaps it's liable to change On 30 Oct 2005, at 21:50, Derek Vadneau wrote: Actually, it's not documented. I remember reading about it at some point, but the local docs and livedocs do not have setTimeout, and it does not light-up for syntax highlighting. It works, but why this would not be documented is beyond me. Derek Vadneau -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Rankin Sent: Sunday, October 30, 2005 4:37 PM To: 'Flashcoders mailing list' Subject: RE: [Flashcoders] setInterval() and the trouble Not sure, but it's in the new ActionScript 2.0 Language Reference for Flash Player 8. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] setInterval() and the trouble
I got some stuff working now ;-=) Looks like I had some infinite loop indeed. Pff. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] setInterval() and the trouble
I imagine you're calling clearInterval with the appropriate interval ID upon each quiz question submittal, and then afterwards recalling setInterval for the new question? How does it fail the second time? Does it just never call it again, or does it call the function at a different interval? Liam On 10/29/05, Weyert de Boer [EMAIL PROTECTED] wrote: Hmm, I am currently working on the good version of the quiz only I have a question how I should implementate some part. The quiz should ask yes/no questions and the user should only have three to six seconds to answer the question. If the user fails to answer the question within this time, the answer should be fault. Currently I used a setInterval() with 3000ms only I never get stuff with intervals right. Always it goes all fine the first question, but the second it fals. Does anyone know a good way to implementate this? Maybe through event delegation instead of a interval callback method? Yours, Weyert de Boer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] setInterval() and the trouble
At first glance it looks like you have a potential continuous loop issue? stopwatchComplete() questionComplete() stopwatchComplete() and so on if (id = questions.length) Second is I don't see where id is defined in questionComplete() did you mean to type this instead: if ( questionId = questions.length ) JOR ___ === James O'Reilly === === SynergyMedia, Inc. === www.synergymedia.net Weyert de Boer wrote: Hi Liam, First of all I always have had trouble with those methods, never got it right. Always failed, I don't they dont like! I imagine you're calling clearInterval with the appropriate interval ID upon each quiz question submittal, and then afterwards recalling setInterval for the new question? How does it fail the second time? Does it just never call it again, or does it call the function at a different interval? Well, I happen to have a resource xml file which get loaded prioer of each group of questions, once this group is readed a method in the root timeline gets triggered which will determine what to do. This method will also trigger the method buildQuestion() when required, this method will create a new instance of question-movieclip. After this part is done the function doStopwatch() is called: function doStopwatch() { // 1second = 1000ms _root.stopwatchIntervalId = setInterval( _root.stopwatchComplete, 3000 ); } function stopwatchComplete() { clearInterval( _root.stopwatchIntervalId ); // trigger the question completed method _root.questionComplete( _root.question.id, _root.question.type ); } function questionComplete( questionId, questionType ) { if ( id = questions.length ) { // out of questions _root.stopwatchComplete(); } else { // next quesiton buildQuestion( questionId + 1 ); } } IF you have a better solution please let me know! I feel so stupid that I don't get thing timer stuff working. Yours, Weyert de Boer ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] setInterval() and the trouble
use setTimeout now and you dont need to worry about interval ids. e.dolecki On Oct 29, 2005, at 11:21 AM, Weyert de Boer wrote: JOR wrote: At first glance it looks like you have a potential continuous loop issue? stopwatchComplete() questionComplete() stopwatchComplete() and so on if (id = questions.length) Second is I don't see where id is defined in questionComplete() did you mean to type this instead: The id should ofcourse matched the correct name of the parameter. If you know a better way please let me know! if ( questionId = questions.length ) Aha, good one I will try ;-) ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders