javascript

Q&A about the latest versions
Post Reply
User avatar
SVondenhoff
Posts: 9
Joined: Wed Mar 29, 2017 12:10 pm

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
User avatar
Hopki
Gnome
Posts: 13004
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

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
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
User avatar
SVondenhoff
Posts: 9
Joined: Wed Mar 29, 2017 12:10 pm

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
Don
Posts: 143
Joined: Thu Mar 07, 2013 2:59 pm
Location: Southern California

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
IronWagen
Posts: 47
Joined: Mon Nov 30, 2015 4:34 pm

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
Post Reply