JavaScript, StoryLine, and web variables

Hello all!


I have a quick question about having a specific function being executed within the published StoryLine presentation.  I have a feeling that JavaScript would be the way to achieve this.


What I'm doing is embedding my presentation on a server where a web based help center will show the presentation and allow users to utilize it on different pages.


What I'm looking to do is find a way, through JavaScript, to send or pull information from the web page to notify the Storyline presentation to go to a specific slide.  In theory (at least in my head) you should be able to do this since JavaScript can pull system information like your system clock or LMS username information.  If I could either gather information from the web page or push information from the web page into the presentation, I could set up variables that would change the slide to one that I specify.  


What I cannot find is a JavaScript to pull specific information from a web page (html5) or a way to identify what web page the presentation is being shown on.


Any help would be appreciated (Even if I'm waaaay off base here and this is not something that Storyline can do).




9 Replies
Steve Flowers

Think of JavaScript as pushing or pulling from the player. In the case of the Flash-based player, you're constrained to a couple of functions. These can be used to grab a variable value from Storyline or push an update to a variable value. 

var player=GetPlayer();
var slVariable=player.GetVar("fromSL");
var newValue=1;

In Storyline, you can listen to variables on a base slide or on a master slide. I use these listeners to check numeric variables. The listener can trigger another event like jumping to a slide or layer, or changing the state of an object.

For your cases above, how you'd do this would depend on how the storyline file is displayed in your page. With a little more detail into how the page will be assembled and the type of events you'd like to trigger from, we can make some recommendations.

Jacob Wiese

Hey Steve, thanks for replying so quickly!

The webpage (which is our internal knowledge base) will have a specific article number assigned to it.  This article number will be in the HTML code as well as in the HTTP address.  On the page, the SL presentation will be embedded in the body of the page near the content.  So it will have information on the subject, the embedded player, then more information if needed.  

In the SL presentation, it will have a variety of different subjects and topics available so that the agents can access that information quickly from the tool.  These topics will also be in our knowledge base, with each subject and topic having it's own specific article number.  

What we would like to do is set the SL presentation up in each article that it references.  When the agent go to the article in the knowledge base, we would like the SL presentation to jump to that specific slide automatically when they open the article.  Each topic is divided into different slides so we won't have to worry about running into layer issues.  

If you need more information than this, let me know.  I should be able to provide you with almost any information that you may need other than specific information in the article and company information.  



Seth Merriam

Hi Steve, (or really anyone that might know...)

Is there something missing from the code above to be able to use this on a master slide? I can not seem to set a variable (that is displayed in a text field on the master slide), so I don't honestly know if its being called properly either.

Initially I wrote my own code as a test, but when that worked, eventually got to a point where I basically just copied your code above, and replaced only the variable names with my own, but that still does not work either :-/

Any help would be greatly appreciated!


Seth Merriam

Hi Steve, thanks for the reply and offer.

I attached two files here actually... one is the *real* file... which, more or less, is a POC to make sure I can use quiz banks as I want to... which is a separate matter. The second file, named "javascript_master_slide" is, as you'll see, just a simply version that has the js on a master slide, with one text box for it to displayed in... but it does not seem to update.

Any help would be great! I'm also nervous its going to turn out to be some stupid thing I just overlooked, but I dont know what that could be at this point ;)


Steve Flowers

Hey Seth - 

I see you're using SL1. I cracked this open in SL2 and it worked for me. Are you, by chance, testing locally?

The Adobe Flash Player has a security "feature" that prevents Flash from communicating with JavaScript. A few ways around this:

1) Hit the Flash Player Security Settings Manager and add your publish location to the whitelist.

2) Publish and upload to a web server (the issue only affects local files)

3) Publish to CD output and run the EXE.

4) Test the HTML5 version. It doesn't have this restriction.

In SL2, it'll give you a warning if you try to run an ExternalInterface command (JavaScript) from the Flash based player. 

Seth Merriam

Thanks for your Reply Steve,

It was exactly what I needed, though – to my chagrin – mostly to remind me that MAMP was open but the servers were not running. So, in fact, it was security settings... sigh. 

Once I did that it all did run well. I'm happy to hear there is a warning that pops up in SL2, if only to save face from me making another post like this ;)

Nonetheless, thanks again for your help, sometimes the best thing to have is a second set of eyes and or a whole new brain ;)

Seth Merriam


FWIW, and maybe to also try and redeem myself slightly after my gaffe by potentially helping someone else, I do notice that when I republish this, I get more constant results if I entirely delete the output folder, and then republish as well... (in additional to cache clearing, etc...) but that might just be my set up.