Processing applets in HTML only actived on click
in
Integration and Hardware
•
3 years ago
I would like to create a web page with maybe a dozen small processing applets inside it. To avoid a drain on system resources, I only want each applet to be run when some image or hyperlink is clicked. I realise I could put each applet in its own page and then open that page, but I'd rather keep everything in the same page if possible. or at least make it appear as though only one page was used. It would also be helpful to be able to 'close' the sketch and free its resources within the page.
Ideally I would like a normal static image embedded in the web page that when clicked starts the processing applet within the same bounds as the image. That way, the static image would appear to 'come alive' when clicked. Perhaps something like the way
sketches appear and can be closed at
openprocessing.org, but instead of automatically appearing when the page is first visited, only when an image is clicked. Solutions that involve running the applets on page load but keeping them invisible until activated won't really work without draining resources.
I am no expert in Javascript, but I would hope that some fairly simple modifications of calls to one or more of the methods in
deployJava.js should do the job, but can't get anything working. Does anyone have a solution to this?
1