Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

param()

Examples
void setup() {
  size(100, 100);

  // Read the value "51" from the following text embedded in an HTML page:
  // <applet code="param_example" archive="param_example.jar" width=100 height=100>
  // <param name="back" VALUE="51">  
  // </applet>
  String bgcolorStr = param("back");
  int bgcolor = int(bgcolorStr);
  background(bgcolor);
}
Description Reads the value of a param. Values are always read as a String so if you want them to be an integer or other datatype they must be converted. The param() function will only work in a web browser. The function should be called inside setup(), otherwise the applet may not yet be initialized and connected to its parent web browser.
Syntax
param(s)
Parameters
s String: name of the param to read
Returns String
Usage Web
Updated on June 14, 2010 12:05:29pm EDT

Creative Commons License