We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › asynchronous LoadStrings
Page Index Toggle Pages: 1
asynchronous LoadStrings? (Read 389 times)
asynchronous LoadStrings?
Jun 9th, 2009, 9:34am
 
As we now have the cool asynchronous RequestImage() is there a asynchronous LoadStrings either available or on the way?   I am using these to interrogate a web site were LoadStrings is giving me the user data file which i parse to extract images then use requestImage to grab the images for me.  

Any help much appreciated..

kindest

nik
Re: asynchronous LoadStrings?
Reply #1 - Jun 9th, 2009, 11:41am
 
Even if there's no handy asynchronous method built-in, you could always create your own threads, as needed.  See this tutorial:

http://www.shiffman.net/teaching/a2z/threads/
Re: asynchronous LoadStrings?
Reply #2 - Jun 9th, 2009, 12:09pm
 
While it may not be the best way, I have done this with a Vector class, createInput, and remembering a few booleans.

Keep track of what state the program is in with booleans (started, fileopened, filefinished, etc).

Then, in draw(), read a string from the inputStream.

I used a Vector because it is thread safe and can be read between the calls to the file.

If you are interested, I can give an example (but I will have to extract it from another program).
Page Index Toggle Pages: 1