javascript in Storyline - Can you look at my code?

Nov 25, 2014

I know SL, but not js. Friend knows js but not SL.

The below code is set to execute when certain keys are hit, but nothing seems to happen. does anyone know if this code is setup right to work with SL


Example 1:




document.bgColor = "#0033CC";


Example 2:

var player = GetPlayer();




example 3:


var player = GetPlayer();


window.document.bgColor = “#990000”;


1 Reply
onEnterFrame (James Kingsley)

Hi Ben,

It is a bit hard to tell from these bits what you want to accomplish. All those alerts firing will most likely fail. I am not sure why you want to alert those. Some of them are DOM/JS Objects and won't automatically convert to a string that you can put in an alert. 

If you are trying to use an alert to help you debug the script then I would suggest you replace them with console.log( MSG ). that will write the info the browser's console (in most browsers you hit F12 to open the console).

Additionally document.bgColor was depreciated a long time ago and I am not sure browsers are still supporting it. Best to use 

Hope that helps,



This discussion is closed. You can start a new discussion or contact Articulate Support.