We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I followed Potomax's guide to binding javascript to the processing sketch but I made one change and the result is puzzling.
I have my javascript call the processing script to bind a function called "play_multi_sound()" in the html javascript to a variable in the processing sketch:
void bindJavascript(JavaScript js) {
soundEffect = function (sound) {
if (sound) { js.play_multi_sound(sound) };
}
}
This works fine. I can call soundEffect() in the sketch and it runs the sound player in the Javascript.
But suppose I want this function to have and initial value that conveniently reports that that the bind hasn't happened if it gets called before the bind happens.
var soundEffect = function(name) {
console.log(name+" is not bound yet");
};
The really odd bevahiour is that whan I call soundEffect() in the processing sketch BOTH functions get called!!! the sound player does get called (I can hear the sound). yet the console also shows the default message as well.
I'm confused,