Forum Discussion
Show a DIV image with a javascript trigger.
Hi David, it might be helpful to know that it is easy enough to take variable values from the Storyline file and so you would be able to get the user to enter their key. For example, defining a variable api_key in Storyline, you would be able to use JavaScript to retrieve this using the following script:
var player = GetPlayer();
const apikey = player.GetVar('apl_key');
Be concious if you scripting is via a webobject, you will need to reference the parent to get the player.
var player = parent.GetPlayer();
const apikey = player.GetVar('apl_key');
So, the WebObject you import, the first task can be to get the api_key from the Storyline file, and then use the key in any further scripting that takes place to integrate the coding environment.
A theoretical process:
- User loads Storyline file.
- Storyline variable "api_key" is blank, load input box asking user to enter api_key
- User enters key, clicks submit
- Key is valid (not sure if you have a way of checking?)
- Load WebObject
- WebObject retrieves api_key from Storyline.
- WebObject then executes script to load coding space (with the provided api_key).
I know this might not match your requirement, but will hopefully give you enough to work with to create your solution.