Simply get the integrated variables with JS

Hi all,
I wonder why I can't get the variables from Storyline with JS.
For me the simplest way to begin with that is something like that : 

var TitreRecup = player.GetVar("Menu.SlideTitle");
player.SetVar("TitreDeSlide", TitreRecup);

"TitreDeSlide" is a declared variable (text) in Storyline but a simple Alert tells me that this is Null (defined but with no value).
Is someone capable to tell me how to do it? Did I miss something?


1 Reply

The Storyline variables are kind of held "at arms length".  I haven't investigated this but I've always assumed they are held in an object or an array. The work around to this is to set an action in Storyline to set a custom variable equal to the Storyline variable and then use that custom variable in your JavaScript.

Something like:

Set MySlideTitle = Menu.SlideTitle  at Time line start.

Your JS would then look like this:
var TitreRecup = player.GetVar("MySlideTitle");
player.SetVar("TitreDeSlide", TitreRecup);