From xradiograph

Processing: Dynamic Load

dynamic loading and unloading of sketch.




well, say you change the images for a P Image? which has to be preloaded (NB: maybe not?)
or you want to change the canvas size, which has to be the first thing set up in setup.


Processing.loadSketchFromSources(canvas, ["pixel8.pde"]);


Also, dynamic unloading of previously loaded code, because otherwise it’ll just start running again



var oldp = Processing.getInstanceById('jstest');
if (oldp) oldp.exit();



Processing.instances[n] does not appear to work, despite assurances in this bug - not evaluated



TODO: some morel links to sources, and notes.


Also, I’ve found that pre-loading a P Image? with a data-uri still takes time to load.


  // wait until image is REALLY loaded from URI
  // crude
  if (img.pixels.length <= 10) return;


Retrieved from
Page last modified on April 08, 2014, at 04:07 PM