Brandon Brandon - 7 months ago 37
Javascript Question

Processing.js FloatList doesn't work on web

My processing.js sketch uses FloatList and it works when I build it with Sublime. However, when I try to run it on a web page, the sketch doesn't load and I get

Uncaught Processing.js: Unable to execute pjs sketch: ReferenceError: FloatList is not defined
from the javascript console. Why is this happening and how can I fix it?

Any suggestions and help would be gratefully appreciated.


Well, the error says it all: Processing.js does not have a FloatList class. You can confirm this by checking out the Processing.js reference.

I'm not sure why Processing.js didn't implement the FloatList class. Maybe because JavaScript arrays are so different than Java arrays. That's just a guess though. Here is an open issue about this on Processing.js's GitHub page. Here is another issue that shows which classes have been implemented. FloatList is indeed not yet implemented.

In any case, you're going to have to modify your code to get rid of the FloatList class.

Of course, Processing.js is open source. So you could always add the FloatList class yourself! You might even be able to copy much of the source directly.