PDA

View Full Version : can a function wait for input?


markmx
03-26-2003, 08:03 PM
can a function run through some code, then start an
animation that will generate some # based on user input,
like animating some dice rolling, then continue running
based on that new #?

Billy T
03-27-2003, 03:00 AM
umm you would probably want to break it up into multiple functions

function first(){
//do stuff then
myInterval=setInterval(wait,100);
}

function wait(){
if (stuffFinished){
clearInterval(myInterval);
continue(param);
}
}

function continue(param){
//do stuff with param;
}

cheers

markmx
03-27-2003, 04:19 PM
Thanks for your reply, I haven't used that before. Might be what I'm looking for.

I was hoping that instead of something like
for (j=0;j<11;j++){
var x = Math.random()*100;
}

I could have
for (j=0;j<11;j++){
var x = goGetTheImput();
}

where goGetTheImput would be another scene that played some animation 0 to 100
and when the user to hit a key it would stop and there would be your #, the
frame it was at.