Get / Set current slide using javascript

Feb 20, 2013

Hey Guys,

I`m wondering if there is a way to do navigation stuff in Storyline using JavaScript codes and not "Jump to" triggers. I particular I`m interested in getting the current slide reference to save into some var to be able to refer back in future.

Any ideas?

Cheers 

11 Replies
Amir Zahedi

Hi Guys, Yes and no. We did manage to get both of these functions running but the issue is that it will only work on the HTML5 version and not the flash version unfortunately, meaning you loose support for legacy browsers, Also as we know there is currently no way to disable flash output that mean's you'll have to manually make html5 version as the default once you've published the course. I've got no code at the moment (weekend) to share but am happy to do so once back at work so let me know if that helps but the key is what Brad has already pointed out, if you use Chrome to inspect the player object in HTML5 version of a published project it will expose all sorts of very useful methods that it holds and they all work like a piece of cake with javascript triggers inside Articulate. I guess it's time we devs make it loud and clear that while we respect the intuitive design, ease of doing most common tasks and the like in Articulate there is no way they can cover all the scenarios and it's time for them to expose APIs for deeper manipulations of projects.

Jim Arbon

I  agree Amir - Storyline is a great tool for rapid development of some pretty nifty e-learning, but when you try to poke even remotely under the hood it gets fiddly or impossible.  You can't even get the number of slides in a scene, even though this information is on the home screen of Storyline, in the bottom left corner.  Let's hope that the SDK, API and/or indeed update 4, whenever they might be released, makes things easier.

Cheers,

Jim

Jay Sprout

I, too, want to change slides using JavaScript instead of using the "Jump To" triggers. How do I refer to slides--what are they named? Is there a function I should use? I've tried looking in the JavaScript of the published output but can't find anything (that I recognize as being) for navigation to base my code on. I am with Jim about being frustrated when trying to do anything manually in Storyline. I miss Flash. So much.

Kevin Mc

Hi Jay,

A way I found around this is to have a trigger on each slide that writes a unique identifier to a Storyline variable. You can then access this variable externally to manipulate it or watch it within Storyline.

Without knowing the specifics of your issue you could adopt the approach above with a watch trigger on the master slide to watch for a change in that variable then have a conditional statement to carry out your action depending on the value.

I hope this helps get you on the right path.

Ideally if we had access to the variables themselves we could avoid allot of manual trigger setup.

 

Jay Sprout

I'm creating an animated menu on the Master Slide using two layers--a "ShowMenu" layer for the opening animation and a "HideMenu" layer for the closing animation. Opening and closing the menu are beautiful things to behold. However, clicking on a menu item jumps to the desired slide--even if I put a trigger to show "HideMenu" before the "Jump to" trigger. It just happens too fast and looks like it's slamming shut--sloppy.

What I want is this:

  1. When the user clicks a menu item it triggers two things: Assigns a value ("1" for slide one, etc.) to a variable (let's call it "slideClicked") then shows the "HideMenu" layer.
  2. At the end of the "HideMenu" layer's time line (just .75 seconds--long enough to show the animation) a trigger jumps to a slide based on the slideClicked variable.

I'm stuck because I don't know how to tell it to "jump to" a slide in JavaScript and I don't know how to refer to the slide so that the Player understands.

If I could use Condition in a trigger to say "If the variable is 1 jump to slide 1" else "if the variable is 2 jump to slide 2" I'd be super happy but it doesn't seem like Triggers can handle anything like that.

 

This discussion is closed. You can start a new discussion or contact Articulate Support.