We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi there, I have quite a large sketch I made in processing which I would like to port to javascript.
I have an issue preloading my images. The problem is that I have sequences of images and the only advice I've seen on preloading is single files in the section before setup like this
/* @pjs preload="image1.jpg"; */or
/* @pjs preload="image1.jpg,image2.jpg";
*/
is this the only way? I have over 30 images. I can type them out by hand but what about situations with more images? when I click JavaScript > Playback Settings (Directives), I click the scan button and nothing happens..
this is the error I get in chrome debug:
http://127.0.0.1:50519/pl/bmanTilt/bManT_0000.png Failed to load resource: the server responded with a status of 404 (not found) http://127.0.0.1:50519/lev/bMap_01.gif Failed to load resource: the server responded with a status of 404 (not found) http://127.0.0.1:50519/pl/bmanTilt/bManT_0001.png Failed to load resource: the server responded with a status of 404 (not found) http://127.0.0.1:50519/pl/bmanTilt/bManT_0002.png Failed to load resource: the server responded with a status of 404 (not found)
... this goes on for all the images
Answers
Official place to place resources in Processing is sketch's subfolder "data/"! L-)
Ah I see, then the scan button works! I am still getting the not found error though. It starts like this however:
"Uncaught TypeError: Cannot use 'in' operator to search for '$overloads' in true"
in "if ("$overloads" in existingfn) existingfn.$overloads[args] = fn;"
I had to copy the data folder into the newly created web-export folder. then open it not directly from explorer (did via dropbox public link) and am now only getting one error:
"Uncaught TypeError: Cannot use 'in' operator to search for '$overloads' in true"
In "JavaScript Mode", when it creates "web-export/", it ends up removing the "data/" subfolder.
But that is done automatically, so it shoulda worked!? :-/
this happens to me even in java mode but I don't usually make a data folder (except in this case). Anyway it isnt complaining about the files missing anymore, just that error which I don't understand.
Any help would be appreciated but the long term solution for me seems to be just learn and use javascript, j5 looks nice.
Does your code have that
in
keyword? You should post relevant parts. We're not fortune-tellers! (~~)I think its part of javascript stuff that gets generated, the whole thing in chrome debug is huge. This is the link to the page: https://dl.dropboxusercontent.com/u/24304389/app/Buttmen_web-export/index.html You can see in debug the in error. or maybe its working for you?
From: https://dl.dropboxusercontent.com/u/24304389/app/Buttmen_web-export/pixP_mc_v1_17_js.pde
At 1st sight, I've spotted these problematic issues:
In order for a "Java Mode" sketch to cross convert into "JS Mode", we should adhere to Processing's API:
http://processingjs.org/reference/ & http://processingjs.org/tools/processing-helper.html
Still getting the same "Uncaught TypeError: Cannot use 'in' operator to search for '$overloads' in true" error. Thank you for the links though and I really appreciate you taking the time to help.