Forum Discussion
GaryKenyon
9 years agoCommunity Member
SL3 Javascript GetPlayer() function not defined in HTML5 output
Hi forum.
I created a game a while back for SL2, my external JS file gets and sets a bunch of Storyline variables using GetPlayer, SetVar and GetVar.
With the release of SL3, I have published th...
WillTribino
4 years agoCommunity Member
One way I managed to solve this is by calling a function from within Storyline that saves the player into a variable in the external js file. This way the player is only called when the player has been loaded for sure.
Example:
In an Execute Javascript trigger call the function (i.e when timeline starts execute js):
callPlayer();
In your JS external file have:
function callPlayer(){
window.player = GetPlayer();
};
By doing this you can call the player from within any other function in your external JS file, as long as the function is called from a trigger in SL.
I´m sure that are other ways to manage the player around the iframe scope, but this is a simple way to avoid calling the player when it does not exist yet.
I hope it helps.
Related Content
- 6 months ago