Page 1 of 1

javascript

Posted: Mon May 22, 2017 4:17 pm
by SVondenhoff
Hello,

I'm currently trying to pass the (changed) value of a variable (variableName) when the user clicks a hotspot. The hotspot url contains the following piece of code:

Code: Select all

javascript:parent.player.SetVar(‘variableName’,Math.floor((Math.random() * 100000) + 1))
Somehow this code does not do anything. Anyone has a clue?

Best regards,


Sebastiaan Vondenhoff

Re: javascript

Posted: Tue May 23, 2017 1:37 pm
by Hopki
HI Sebastiaan,
What are you trying to do?
I take it your referring to the variable in the skin, why not use a set variable action?
Regards,
Hopki

Re: javascript

Posted: Wed May 24, 2017 11:42 am
by SVondenhoff
Hi Hopki,

I'm trying to pass a signal that one or more variables have changed within the 360-tour, which is embedded as a web object in Articulate Storyline (E-learning authoring tool). In Articulate Storyline I can create a setup so that it "listens" via Javascript.

Regards,


Sebastiaan

Re: javascript

Posted: Wed May 24, 2017 11:08 pm
by Don
Sebastiaan, in your code are those truly apostrophes around 'variableName' ? Because what you have shown above are invalid characters for a Left-Single Quote and a Right-Single Quote. Notice they are slanted a bit.

True apostrophes should look straight up-and-down like these:
parent.player.SetVar('variableName',Math.floor((Math.random() * 100000) + 1))

Just guessing,
Don

Re: javascript

Posted: Mon May 29, 2017 11:59 am
by IronWagen
If it still does not work then maybe you should not use variables in Pano2VR but rather in external js code. You could handle the random number thing in a separate function. I have noticed it's much easier that way