Forum Discussion
BenJohnson-f90c
3 years agoCommunity Member
Send variables from web object
Hi,
I'm trying to send a variable from a web object to storyline to display that value on the screen. In my web object HTML page, I have this:
let testVar = "Hello World"
In my storyline f...
Jürgen_Schoene_
3 years agoCommunity Member
(1) you have imported the webobject the wrong way
create a folder and insert the index.html, then import the folder - NOT the index.html
(2) if you publish, the webobject will be inserted as an iframe, so you need "parent." to connect to storyline
(3) GetVar() is wrong, you need SetVar() to change the variable in storyline
let value = "Hello World"
if (!parent.GetPlayer) {
console.error( "storyline player not found" );
} else {
let player = parent.GetPlayer();
player.SetVar('testVar', value );
}
result:
https://360.articulate.com/review/content/9d6090df-4a37-4c27-9ade-2604c8113e05/review
Important: If you change anything in the webobject, you have to delete the webobject in storyline and reimport it - there is no autoupdate