Javascript not reading Captivate 8 variable
I am trying to embed an HTML5 'app' made in Flash Pro CC in all slides of an HTML5 Captivate 8 project.
I have used Flash a lot to create HTML5 for Captivate projects so have plenty of experience so far.
The scenario is that I am setting up a Captivate template with some pre-defined variables in it with default values for the variables.
My Javascript in the HTML5 app needs to read the initial default value of one of the Captivate variables.
The trouble is when I read the variable and display using console.log it shows 'undefined' in the browser developer pane
However if I set the variable using Javascript first and then read it, the variable returns a correct value.
I'm using:
console.log( window.parent.window.cpAPIInterface.getVariableValue("PB_Ignore_Slides"));
to read and display the variable
PB_Ignore_slides in template = 0
However I have tried 1,2,3 and '1' amongst other values.
They all return 'undefined' in Javascript.
The code is at the begining of the embedded HTML5/Javascript.
