I have a javascript function that is being called from a hotspot. The function looks like the following in the skin.js:
Code: Select all
this._svg_1.onclick=function (e) {
window.addEventListener('click', function() {liveCode.myLiveCodeHandler2();});
}
I built a very basic html page to simplify the problem for myself. The following script works fine in the browser window, and the functions are called only when the user clicks each button:
Code: Select all
<!DOCTYPE html>
<html>
<body>
<p>Click the button to trigger a function that will trigger an answer dialog in LiveCode.</p>
<button id="1">Button 1</button>
<p>
<button id="2">Button 2</button>
<script>
var myFunction = document.getElementById('1').addEventListener('click', function() {liveCode.myLiveCodeHandler2();});
//the above button is identified by having the id of '1'. That is how it is able to call a specific function.
var myFunction2 = document.getElementById('2').addEventListener('click', function() {liveCode.myLiveCodeHandler1();});
document.getElementById(clicked_id).onclick = myFunction
document.getElementById(clicked_id).onclick = myFunction2
// The above script is getting the button IDs when a user clicks on a button.
</script>
</body>
</html>
How to I get Pano2VR skin.js to specifically identify the hotspot that is being clicked on? I’m not very familiar with JavaScript, but it seems the issue is with the line:
Code: Select all
window.addEventListener('click', function()
John Patten
SUSD