Forum Discussion
SamClark
12 years agoCommunity Member
Storyline True/False variable comparison
UPDATE:
After further testing, I found that JavaScript setting a variable to "true" in Storyline ONLY FAILS IN HTML5. All is well in the flash versions. Simply put, a Storyline variable set "tr...
NormCousineau
10 years agoCommunity Member
With HTML5, quotes are required ("true" rather than true).
GetPlayer().SetVar("varName",true); // does NOT work in HTML5 version.
GetPlayer().SetVar("varName","true"); // works in HTML5 version.
Here's another thing to watch out for with HTML5. Say you have a numeric variable in Storyline with default value 2.
The typeof operator in JavaScript will return "string" (when checking that var using GetVar).
BUT if you change the value of that variable from its default (with JavaScript or in Storyline) then typeof returns "number".
For me, that means I must use non strict == instead of strict === when checking equality of a numeric var from Storyline with a number in JavaScript.