SL2 Javascript issues
Oct 28, 2015
By
Bud Keegan
I've read through the threads on this but still can't get resolution on my issue. I have a short module that has a JS random number generator as follows:
var randomnumber = Math.floor((Math.random()*100)+1);
var player = GetPlayer();
player.SetVar("randnum",randomnumber);
It works in one module but not in another one. I've published both to CD, allowed permissions in browsers (testing in both IE and Chrome) and used the same JS as above. These need to ultimately be published to CD and won't run on an LMS.
Any ideas why there's different behaviour-- and how to correct?
2 Replies
You script works fine. Just to cover all the bases, did you set upa variable called randnum in your Storyline project?
I did. And I used the JS in a test file where it worked fine. As I haven't built it out I'm just going to assume the 2nd fileis corrupt somehow and re-pot in the new test mod. Tks for checking on your end-- nice to know I'm not going nuts!
This discussion is closed. You can start a new discussion or contact Articulate Support.