I'm using the following code listed in the processingjs docs to load an image onto the canvas. Because I'm using this in JS mode, I'm prefixing the Processingjs code with Processing object, e.i. the "processing."
/* @pjs preload="laDefense.jpg"; */
processing.PImage b;
b = processing.loadImage("laDefense.jpg");
processing.image(b, 0, 0);
When I use this code, I get the following error: "Uncaught SyntaxError: Unexpected identifier"
The Processingjs docs reference the following snippet for loadImage() (http://processingjs.org/reference/loadImage_/):
// @pjs preload must be used to preload the image
/* @pjs preload="laDefense.jpg"; */
PImage b;
b = loadImage("laDefense.jpg");
image(b, 0, 0);
Does anyone know why I get this error?
I tried using the second listed snippet in the standard mode--in a .pde file, and it worked fine.