Click to See Complete Forum and Search --> : Speed in Applet


Alien Man
01-21-2003, 02:17 PM
newbie to the forum.
I would like to control the speed of the water on an applet since it runs slower and faster depending on the chip speed for different computers. The problem is that I can only slow it down or speed it up only once. The script is called from an html page which in turn does a document.write to produce the same page but with a different speed. For the one time that I can use it it works great but I would like to use it more than once if needed. The following is a snipet of the code.

CODE..............

var speed = 0;

function reLoad(txt,frm)
{
speed = frm.frmSpeed.value;

if(txt == "A")
{
speed += 10;
}
else
{
speed -= 10;
}

output("ouput stuff goes here");

output+="<form name='waves'>";
output+="<input type='button' value='Slow down Waves' onClick='reLoad('B', this.form)'>";
output+="<input type='button' value='Speed up Waves' onClick='reLoad('A', this.form)'>";
output+="<INPUT type='hidden' name='frmSpeed' value=" + speed +">";
output+="</form><Body><HTML>";


document.write(output);

The hidden field is used to pass the current speed to the script.

Thanks

Alien Man
01-21-2003, 08:04 PM
Would there be a better way of setting the speed on the fly within the aplet?

Alien Man
01-23-2003, 08:22 AM
Can anoyone give me some ideas. Any idea at all:D :) :)