Skip to main content
Inspiring
April 25, 2018
Answered

Get value of variable with Javascript

  • April 25, 2018
  • 1 reply
  • 2378 views

Hi

It is silly but I am afraid I cannot get the answer to a very basic question...

How would I populate the Current frame value when I use this line in the OnEnter action?

window.cpAPIInterface.getCurrentFrame();

I can populate the text "Text for the variable" in a TEB with the variable "varMyvariable" with this line.

window.cpAPIInterface.setVariableValue("varMyvariable","Text for the variable.");

but I am missing something very basic here ...

Thank you in advance

B

This topic has been closed for replies.
Correct answer ankits61431843

1) OnEnter Action:- Execute javascript

var vframe = window.cpAPIInterface.getCurrentFrame();

2) On captivate slide to show the variable value:-

  $$vframe$$

3) create vframe variable in captivate variable also.

1 reply

ankits61431843
Inspiring
April 25, 2018

Hi You are calling a function in the OnEnter action which will return currentFrame value but to show the value on screen you have to assign that function to a variable and then use on captivate stage $$variablevaluename$$.

ankits61431843
ankits61431843Correct answer
Inspiring
April 25, 2018

1) OnEnter Action:- Execute javascript

var vframe = window.cpAPIInterface.getCurrentFrame();

2) On captivate slide to show the variable value:-

  $$vframe$$

3) create vframe variable in captivate variable also.