The Common JavaScript Interface for Adobe Captivate is a JavaScript object that is automatically provided by Captivate when viewing a project in a web browser. It is used as an interface between your Captivate content and the web browser used by the student to view the course. In this example, we need one function (called a method in geeky JavaScript jargon) from the Common JavaScript Interface for Adobe Captivate.
We will use the setVariableValue() method to give a value to the v_randomSuccess and v_randomFailure Captivate variables using JavaScript. To use this method, you must provide two parameters. The first one is the variable you want to assign a value to, and the second one is the value itself. Thus, the basic syntax of this method is as follows:
window.cpAPIInterface.setVariableValue("name_of_Captivate_variable", "value_of_the_variable");
This corresponds to what you see on the...