Controlling navigation from JavaScript

Hi everyone,

I am trying to build a simulation where an external JS function determines the next slide that should be visited.

In lack of a better option, I did this:

To the button that controls navigation in each slide, I added the JS code:

var player=GetPlayer();
var aleg=player.GetVar("Aleg");
player.SetVar("urmatorulEcran",urmatorulEcran(aleg));

Aleg is a Storyline variable set by the user interaction in the slide. urmatorulEcran is another Storyline variable that I am hoping to set with my JS function.

urmatorulEcran(aleg) is the function that calculates the next screen according to what the user chose on the slide and other things.

Then I test the value of urmatorulEcran (meaning next screen) and I send the learner accordingly.

However, it does not work (the slide does not change). I tested the JS function outside SL and it works fine.

Any ideas?

Thanks,

Ioana

2 Replies