Pause the timeline using javascript

Jun 15, 2014

Hi Everyone,

I was wondering if anyone knows how to pause the storyline timeline using javascript. What I am doing is using a button inside of storyline to call a javascript based modal window and I need to be able to pause the main layer timeline when this is called.

Any help would be awesome and a Javascript call would really seal the deal here for me. 

Cheers,

Brodie Greig

8 Replies
Steve Flowers

Hi Brodie,

You can pause the timeline of the base timeline with a layer. Under layer properties, select the box for "pauses base layer". In this case, putting your JavaScript trigger in the layer would launch your window only after the timeline is paused. To resume, you might try putting a trigger on that layer that hides the layer when a variable changes. I use variable listeners and variables that increment all the time to "remote control" actions.

Let's say you have a variable called unpause (number variable). You add a trigger to your layer to close when this value changes. In your launched window (either in onUnload or with a button event), you use var player=window.opener.GetPlayer(); to create a connection to the player API. Then you grab the value with var unpause_value=player.GetVar("unpause");. Follow this with unpause_value++ and then player.SetVar("unpause",unpause_value);

This will increment the variable in Storyline, causing your waiting listener to fire and close the layer. When the layer closes, the timeline will resume playing.

Brodie Greig

Hi Dennis and Steve,

Thank you so so much for your answers. The web object is a good option, I've been trying it out and I think it could work. Thanks Dennis!

But what I am most interested (because of what would save us the development work that we have already done) is your solution Steve. That's a great idea, "pause by layer" and then "unpause" based on variable change detaection ie using ++. At the moment Steve, I am trying to change/increment that variable - that is being listened to to close the layer inside the player from external javascript - but am having no progress trying to set it from the browser. I think I'm not seeing var player=window.opener.GetPlayer();

I will keep attempting to access this and let you know how I go. If you have any tips where I might be going wrong, I'd love to hear them.

Thanks Dennis and Steve,

Regards, Brodie

Jody Zarn

Hey Steve, 

Is there any way I could con you into perhaps making a video tutorial about adding a pause button.  I've read through the instructions and looked at your posts on another thread and although I've done a few things I just can't seem to get it to work. Or do you know of a video tutorial perhaps?  I'm relatively new at Articulate and I just can't grasp this. And if you can't/don't want to--that's okay too!

Brodie Greig

Hi Steve,

Thanks for your help, your idea was genius! I have been able to get it to work using standard javascript calls to get to GetPlayer() e.g document.getElementByID's and so on. I can now grab and set the variables as you wrote and I'm positive it will work perfectly as a listener.

Can't thank you more.

Cheers,

Brodie Greig

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