Loading...
Logo
Processing Forum
Hi there,
I'm using ControlP5 control library in my project and it works nicely in Java mode, but when I try to run it in JavaScript mode in Chrome browser it says: 
     Uncaught Processing.js: Unable to execute pjs sketch: ReferenceError: ControlP5 is not defined
 
probably the next error is related to the first too:

Uncaught TypeError: Cannot call method 'draw' of null

What I have to do to make it working on-line ?

Replies(8)

Moved topic from Contributed Libraries.
Basically, if your sketch is doing any "import" statement, it won't run in JavaScript mode. Java libraries doesn't work with PJS.

Oh my God ! How to make it sound than ?
What?

Looking at the Libraries page, I see a new kid in town: Guido was made to be compatible with the JavaScript mode...
I believe Quarks worked on his G4P library to make it JS-compatible, but I don't know if it is done.
Hi,
Thank you for your responces ! They are really helpfull ! 
Just tried Guido, but in Java and JavaScript modes it says:

1) in the Java mode:

The class de.bezier.guido.Interactive is incompatible with Processing 2.0.
A library code (or other code) is using registerMouseEvent() which is no longer available.

2) in the JavaScript mode:

Uncaught Processing.js: Unable to execute pjs sketch: ReferenceError: Interactive is not defined

Am I doing something wrong ? On what version of processing this library is supposed to be working ? I have Processing 2.0.18  
Mmm, strange, the page mentions Processing 2.0 and last commit is only one month ago, so it should be OK with this version.

Out of curiosity, I will try it and report back.
I installed Guido via the PDE's interface, then I restarted Processing (2.0 currently).
I was able to load the examples, although they are messing up the interface.
Probably because they have a sketch.properties file that forces the PDE to load them in the JavaScript mode... which I haven't installed yet!

But by copy & paste in a clean window in Java mode, I can run the first examples, so it definitively works with Processing 2.0.

[EDIT] Yes, once I removed the sketch.properties files, the example sketches loaded and worked without problem.

How did you install Guido?
I installed it manually - I downloaded the Guido.zip file from the page the adress you gave me  https://github.com/fjenett/Guido then inzipped it and moved to libraries directory in Processing folder, so when I started again my Processing it was already there.
Hope it'll help.
I don't know if the zip file is up-to-date. It is better to use the Processing's way of installing libraries, anyway, when it is available.