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