Forum Discussion
BartVandenBr275
2 years agoCommunity Member
Javascript events in Storyline
Hi all, I am trying to send a custom javascript event from an embedded storyline web object to storyline. I would like to listen for this event in a javascript trigger. However, I am unable to...
SamHill
2 years agoSuper Hero
Hi Bart,
One way you can get Storyline to react to an event from JavaScript in a WebObject is to change a variable value in your Storyline file.
You could have a variable called "listener" (type text) in Storyline. You can then update the value of this variable from your WebObject:
// Get reference to storyline player
// using parent, as a WebObject is in an iframe
const player = parent.GetPlayer();
player.SetVar("listener", "dosomething");
Then in Storyline, you can set-up a trigger that reacts when the variable "listener" is changed, for example:
Jump to slide next slide
When the variable changes
listener
If listener = value "nextslide"
One thing to look out for though, is sending multiple "nextslide" values to the variable will not trigger a change, as it is the same value. You would always have to set your variable back to "(blank)" to ensure that each event, is a variable value change.
Will that help with your situation Bart?