Forum Discussion

1Articulate's avatar
1Articulate
Community Member
27 days ago
Solved

java script not definied

Hello community,

I have the following problem with an older training file and JavaScript.

We want to use JavaScript in our training files.
This is very easy in Storyline. I created and saved a new story file > added a trigger > added the JavaScript, and that's it. So far, so good.

Now I wanted to build exactly this working JavaScript code into an existing training file. So I opened the story file again > added a trigger > done. But unfortunately, I get an error in this training file, and the script isn't executed.

To me, it looks like the JavaScript library isn't available in the old story files at all. But maybe you have some experience with this?

And yes, I saved the story file and imported it into a new story file, but nothing helped. I also simplified the code to eliminate code errors. So, there's only an alert message, which works in the newly created file but not in the old one.

Java Script Code: alert("Hello");

Error: actionator::exeJavaScript - Script1 is not defined (anonymous) @ bootstrapper.min.js:2

Best regards Markus

 

  • That often means there is some syntax error such as mismatched quotes, braces, parentheses, etc. Is the alert statement above copied directly from your script, or did you retype it? Make sure the quotes are actually plain quotes, not the curly quotes you often get when copying text from Word or the web. 

    Try disabling the script containing that statement and see if it works without error to make sure the error is actually there and not somewhere else. 

    Try starting over with the original working project file and add only small bits of javascript to ensure each piece works before adding more if you have troube narrowing it down.

    Also, try pasting your JS code into https://jshint.com/ to check for erorrs before putting it into you SL trigger.

2 Replies

  • That often means there is some syntax error such as mismatched quotes, braces, parentheses, etc. Is the alert statement above copied directly from your script, or did you retype it? Make sure the quotes are actually plain quotes, not the curly quotes you often get when copying text from Word or the web. 

    Try disabling the script containing that statement and see if it works without error to make sure the error is actually there and not somewhere else. 

    Try starting over with the original working project file and add only small bits of javascript to ensure each piece works before adding more if you have troube narrowing it down.

    Also, try pasting your JS code into https://jshint.com/ to check for erorrs before putting it into you SL trigger.

  • 1Articulate's avatar
    1Articulate
    Community Member

    thanks for your help.

    the solution was to disable all java script and copy and paste the one script line by line into articulate and test it. The error was a space in the code.