0

This two question is happend in the same html.

  1. I have a .pde file will detect user mouse click, and there are few object in it, if the user click on the first one, I will get '1' as output and so on. And I have create a var in javascript to store the output, but how can I change the var value in processingjs?

  2. How can I load different txt into a div in html depends on the var that return by processing js? When I done part one, and depends on the user click on different object, I want to load different txt in to the div. (e.g if object 2 is clicked, text2.txt will be loaded in div)

OOLONG
  • 1
  • 1

1 Answers1

0

1: you don't need a special JavaScript var for this, you can track it in you sketch until you need the result on your page.

2: make your sketch tell javascript what to do when you click - see http://processingjs.org/articles/PomaxGuide.html#interface on how to make a sketch and javascript talk to each other while keeping your code runnable on both the web and in the Processing IDE

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153