Javascript questions

I have some questions regarding js in storyline

1.

So when I enter a slide I call some javascript to setInterval ... is there a way to stop this in another slide ? or to call a function in the previous slide? is all .js global?

2. Is it possible for .js to control storyline .. for example change slides, jump to scene etc ?

thanks ! 

- am trying to make a countdown timer, which if its count =  "0" it will go to the "home" screen. Every time the user enters a new slide the "count" resets to "30".

This is as close as I have come to a working example: 

Player.SetValue("count", 30);

var timer = setInterval(function(){onTimer()}, 1000);

function onTimer() {

   var count = Player.GetValue("count"); 

  count--;

  Player.setValue("count", count);

   if(count == 0) {clearInterval(timer)};

}

// but I "should have" 

function startTimer() {}

function endTimer() {}

// these should be called from storyline on the correct slides ?

Paul

Be the first to reply