storyline 2 - html5 output: javascript commands not working

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?

6 Replies
Christie Pollick

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. :)

Steve Flowers

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);

 

Karen OBrien

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.