2 way communication between content in an IFrame and Storyline

Hi there, I am new to Storyline and I have been having trouble changing/reading a variable that I created in storyline from an web object containing my content. Anyone have any suggestions? I just can't seem to find any documentation that its will work with Articulate Storyline 360. From what I have gathered online I have tried a few different methods I have noted below but none seem to work. 

iFrame Click Grabs Variable from Parent
Throws error access is denied. Code is in the web object or iframe and is triggered when button is pushed from within in there. Thanks in advance!

function doMyAlert2(){
var someJSVariable = parent.GetPlayer().GetVar(’numberBox’);
alert(’working number = ‘ + someJSVariable
}

iFrame Click Triggers function on Parent from iFrame
Throws error Unable to get property 'frameElement' of undefined or null reference. Code is in the web object or iframe and is triggered when button is pushed from within in there.

window.frame[0].frameElement.contentWindow.doMyAlert();

Added this code to the story_html.html
<script LANGUAGE="JavaScript1.2" SRC="story_content/myJavascript.js" TYPE="text/javascript"></script>

Parent (storyline)click Triggers function in webobject iFrame
Notes: this assumes only one webobject on slide. Currently throws a permission denied error

$('iframe')[0].contentWindow.c3_callFunction("setMyVar",[""+GetPlayer().SetVar("numberBox")+"6000"]);

Parent (storyline)click Triggers function in webobject iFrame
Note this caused code in project to not work. Currently commented out.

$(’iframe’)[0].contentWindow.doMyAlert();

Add this code to the story_html.html
<script LANGUAGE="JavaScript1.2" SRC="story_content/myJavascript.js" TYPE="text/javascript"></script>

1 Reply