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 › Possible to get parameters when processing on web
Page Index Toggle Pages: 1
Possible to get parameters when processing on web? (Read 824 times)
Possible to get parameters when processing on web?
Aug 21st, 2007, 6:06pm
 
I would like to put a Processing sketch on a web page,
but have it accept parameters, ... in the same way that
a flash applet can.

For example, with flash, you can do the following:

<ember src="http://www.server.com/applet/example.swf"
quality="high" bgcolor="#22FF22" width="500" height="300">

Does anyone know of a mechanism that would allow
a Processing sketch to get access to values of parameters like:
quality, bgcolor, width, height, etc. ?

thanks,
 David Jones

http://www.ece.mcmaster.ca/djones/processing
Re: Possible to get parameters when processing on
Reply #1 - Aug 21st, 2007, 7:19pm
 
sounds like a job for param()
http://processing.org/reference/param_.html
Re: Possible to get parameters when processing on
Reply #2 - Aug 21st, 2007, 11:36pm
 
fry wrote on Aug 21st, 2007, 7:19pm:
sounds like a job for param()
http://processing.org/reference/param_.html


Thanks so much for the quick response.
param() works like a charm.

I noticed that Processing 0125 now exports applets by generating HTML that uses <OBJECT> instead of <APPLET> (which is now deprecated, so that's cool).

I also noticed that all the default <param> values generated by Processing have the following format:

Code:
<param name="image" value="loading.gif" /> 



where it could be put more concisely:

Code:
<param name="image" value="loading.gif"> 



I was curious why it generates " />" when the simpler ">" is all that is required.  Maybe it's just a stylistic thing.

-- djones
Re: Possible to get parameters when processing on
Reply #3 - Aug 22nd, 2007, 12:12am
 
/> makes it valid XHTML, whereas > isn't.
Re: Possible to get parameters when processing on
Reply #4 - Aug 26th, 2007, 6:52pm
 
the /> terminates the <param tag, depending on what's between the tag, it will validate xhtml
Page Index Toggle Pages: 1