JavaScript error in Storyline

I don't always use JavaScript in the projects I work on, but have done so before. I recently ran into a new issue that made me wonder if there's a bug in some recent version of Storyline.

Any JavaScript I try to run - even something as simple as setting a variable like below...

var player = GetPlayer();
player.SetVar("userName","Tom"); not working and giving me an error when viewed in a browser. In Chrome's console, I see a warning:

actionator::exeJavaScript - this execUserJs is not a function. (app.min.js:3)

Screen shot attached.

Any ideas?

10 Replies
Scott L

This is really helpful, Michael, thanks! Your demo worked as we would expect.

What I should have done was, like you, created an isolated test file - your work here is an excellent reminder of that ;-)

I copied your button into my file (which is from a client of mine), using SL360, and published it. I still get my problem. But I think we're done here for now - there is obviously something afoot with my clients file beyond the ordinary. But at least I know that versus thinking it's a bug in the latest version of SL360 or something.

Right now, I tried doing the good ol' "Save as...", and tried copying the button/code to a new blank slide, and neither of those helped. If I figure out what's wrong or find a work-around, I'll post here again for any other (hopefully rare) unlucky people who run into this issue.

Thanks again!

Scott L

Good call, Matthew - that was it. I was trying to call an external JS function which takes a string as a value. It has mis-typed and entered "some string here', using a double quote on one end of the string and a single quote on the other.

It's interesting to know how SL reacts when I've included a JS error and what JS warning it emits in this situation; I'll know what to think next time I see this problem. Thanks for the note!

Scott L

For sure! I'm a VS Code guy, and Atom is another top one! My stupid little problem came from doing too many things at once, and typing the JS code into the tiny JS editor window of Storyline (it's a call to a JavaScript API I'm writing to save data to a storage object that an Adobe AIR app can read from, where the app is a launcher for several Storyline courses).