FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   setInterval
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: setInterval  (Read 407 times)
capeta


setInterval
« on: Nov 18th, 2004, 5:34am »

Hello, im coming from AS 2.0 and JavaScript... is there a way to implement a method just like setInterval over java ? If there is, could you give me and exemple ?
 
Thanks a lot in advance!
 
joe, brazil
 
arielm

WWW
Re: setInterval
« Reply #1 on: Nov 18th, 2004, 9:41am »

with javascript you don't have the concept of loop(), that's why you have to rely on setTimeout().
 
the idea is that you can do all your logics within loop(), including "time management":
 
e.g. each time you enter loop(), a variable is incremented, then depending on its value you can jump to diferent sub-routines...
 
hth
 

Ariel Malka | www.chronotext.org
capeta


Re: setInterval
« Reply #2 on: Nov 18th, 2004, 2:41pm »

yeah, i thought of that too, i use this style to control cpu usage over actionscript and javascript.
 
anyways, i was just checking... thank you.
 
fjen

WWW
Re: setInterval
« Reply #3 on: Nov 18th, 2004, 4:58pm »

in java timers can do what actionscript:setInterval / javascript:setTimeout does.
 
http://java.sun.com/docs/books/tutorial/essential/threads/timer.html
 
/F
 
capeta


Re: setInterval
« Reply #4 on: Nov 18th, 2004, 6:05pm »

thank you a lot! that was just what i was looking for!
 
fry


WWW
Re: setInterval
« Reply #5 on: Nov 18th, 2004, 9:37pm »

fyi.. using Timer will break inside a web browser on about 65% of the machines out there, because they're using Microsoft's implementation of Java 1.1 rather than Java 1.3 or newer.
 
sounds like we need to implement one for Processing.
« Last Edit: Nov 18th, 2004, 9:38pm by fry »  
Pages: 1 

« Previous topic | Next topic »