Skip to main content
pauldbabs
Inspiring
May 31, 2017
Question

Javascript not reading Captivate 8 variable

  • May 31, 2017
  • 1 reply
  • 209 views

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.

    This topic has been closed for replies.

    1 reply

    pauldbabs
    pauldbabsAuthor
    Inspiring
    June 1, 2017

    Oops!

    I made a mistake. The variable name in my javascript had a lowercase character, where as the variable in Captivate had an Uppercase character.

    There is no problem.

    One of those bad days yesterday!