My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

Processing.as is a port of the Processing programming language to ActionScript. It includes a fully functional parser and evaluator, as well as an API layer, to run many existing and new Processing scripts. To check out Processing.as in action, take a look at the following examples:

Using Processing.swf

The processing.swf file can be placed in any webpage and loaded with a Processing script dynamically via JavaScript. First download the compiled package. Embed the processing.swf in your page, and include the "processing.as.js" file. To interact with the swf, add methods to the ProcessingAS variable. For instance:

var Processing = null;

ProcessingAS.onLoad = function () {
	// movie loaded, get object reference
	Processing = document.getElementById('processing');
	// start interactivity
	Processing.start();
}

ProcessingAS.onStart = function () {
	// drawing APIs are now available
	Processing.size(200, 200);
	Processing.fill(255, 0, 0);
	Processing.rect(0, 0, 100, 100);

	// run some Processing code
	Processing.run('line(0, 0, width, height)');
}

ProcessingAS.onResize = function (w, h) {
	// Processing canvas resized; resize embedded element
	Processing.width = w;
	Processing.height = h;
}

Using the Library

The Processing library can be used for its API or for its Parser. To get started, download the source and unpack it to your script directory. You can take a look at the root-level processing.as for an example, or view the classes in the api/ folder for more information.

To use it in a script, you'll want to create a new Processing object, call .evaluate() with your code, and then .start(). Additionally, you can call the API methods directly with the .applet.graphics reference (an instance of the PGraphics class).

Credits

Many thanks go to John Resig for his work on Processing.js, and the folks over at Processing for their work in developing the language.

Powered by Google Project Hosting