In our course we are using Storyline's default top bar buttons but with custom actions (as shown below). So for example, when the 'transcript' button is clicked, it sets the variable openTranscript to true, which in turn opens the 'transcript' layer on the slide.
This works fine on the pc when run through story.html. However when run through story_html5.html on the pc (both IE and Chrome) or on ipad (safari) the buttons simply don't work. Any ideas?
Hi, Karen -- Sorry to hear of your difficulties, but unfortunately, we are not able to provide support for JavaScript coding. Luckily, we have lots of community members who are usually more than willing to share their expertise to assist! You may want to share your file so that others are better able to help you here.
And for those who'd like to review it, here is a sheet on JavaScript Best Practices you may want to keep handy. :)
I found a resolution - after a bit of fiddling I discovered that true/false variables don't seem to work too well with storyline+html5. I changed my openTranscript variable to 'on'/'off' (text) rather than true/false and it now works ok.. strange!
I've attached my test file if anyone's interested - I suspect it may be a case issue - i.e. True/False vs true/false. When trying to set openTranscript to true (using above javascript) - I get this error msg in the Chrome developer console:
I've noticed some strange issues with True / False so I tend to avoid them. Your text solution is a good one. Another that I've used is incrementing a number value.
var player=GetPlayer();
var oTranscript=Number(player.GetVar("openTranscript"))+1;
Sorry to dig up an old thread but I've just discovered that true/false in storyline must actually be string values rather than booleans as you'd expect. I'm deducing this because if I use player.SetVar("openTranscript", "true"); instead of player.SetVar("openTranscript", true); it also fixes the above issue.
6 Replies
Hi, Karen -- Sorry to hear of your difficulties, but unfortunately, we are not able to provide support for JavaScript coding. Luckily, we have lots of community members who are usually more than willing to share their expertise to assist! You may want to share your file so that others are better able to help you here.
And for those who'd like to review it, here is a sheet on JavaScript Best Practices you may want to keep handy. :)
I found a resolution - after a bit of fiddling I discovered that true/false variables don't seem to work too well with storyline+html5. I changed my openTranscript variable to 'on'/'off' (text) rather than true/false and it now works ok.. strange!
I've attached my test file if anyone's interested - I suspect it may be a case issue - i.e. True/False vs true/false. When trying to set openTranscript to true (using above javascript) - I get this error msg in the Chrome developer console:
Hi Karen -
I've noticed some strange issues with True / False so I tend to avoid them. Your text solution is a good one. Another that I've used is incrementing a number value.
var player=GetPlayer();
var oTranscript=Number(player.GetVar("openTranscript"))+1;
player.SetVar("openTranscript",oTranscript);
Sorry to dig up an old thread but I've just discovered that true/false in storyline must actually be string values rather than booleans as you'd expect. I'm deducing this because if I use player.SetVar("openTranscript", "true"); instead of player.SetVar("openTranscript", true); it also fixes the above issue.
Thanks so much for stopping in to share your discovery, Karen! Hopefully others will find the information useful, as well. :)
This discussion is closed. You can start a new discussion or contact Articulate Support.