Variables



Variables in Adobe Captivate act as placeholders for data. The relevant data is associated with the variable during user input or when the output SWF is played. The data can be used for the following:
  • Provide feedback to the user

  • Create advanced actions

  • Configure widgets

For information on using variables in captions, advanced actions, and widgets, see the respective Help sections.

In Adobe Captivate, you can use variables when working with the following:
  • Text captions

  • Actions and Advanced actions

  • Widgets

  • Getting/setting variables in Adobe Captivate SWF files using JavaScript

  • Movie navigation

There are two types of variables available in Adobe Captivate: system variables, and user-defined variables.
System
Variables that are available in the system that you can use. You can also customize the values for some of the system variables.
System variables help you pick up data from your computer and manipulate it through scripting. In Adobe Captivate, system variables are classified as follows:
MovieControl
Lists variables for events that control the movie like pause, resume, previous, next slide, and so on.

MovieInformation
Lists variables related to the movie such as variables for the current slide, current frame, and so on.

MovieMetaData
Lists variables that provide information about the project such as project name, author, and company. You can set values for the variables in this list. You can also set this information using the Preferences dialog box under Project > Info. In project templates, when you set these values using variables, the values are used for the project to which the template is applied.

SystemInformation
Lists variables that can be picked up from your computer such as current date and current time.

Quizzing
Lists variables related to quizzing, such as the variables that capture the number of attempts and the percentage of questions answered correctly.

For example, you can use the system variable cpInfoCurrentTime in quiz slides to display the time remaining for the user to complete answering the question. You can also use the variable in a widget to provide a progress bar or a time ticker.

User-defined
Variables that you create and to which you assign a name and value.

You can use user-defined variables to store data that is used or updated many times in the Adobe Captivate project. Each variable has a unique name, and a value corresponding to the text that is stored in it. When you modify the value of a variable, the changes to the corresponding text are reflected throughout the project. Apart from saving time, variables help achieve consistency and minimize errors in a project.

For example, you can use user-defined variables to specify version numbers of products. At all places where you want to add the version number in a project, add the variable instead. When you set the value for the version number in the corresponding variable, the value is displayed at all places where you inserted the variable. Similarly, when you want to modify the version number, you just have to change the value of the variable.

When you use system variables for this purpose, you do not have to manually correct the slide number when the slides are reordered.

Variables extend the reach of Adobe Captivate by allowing you to do the following:
  • Customize Adobe Captivate to your requirements: You can use variables in advanced actions to provide advanced interactivity in your Adobe Captivate projects.

  • Integrate Adobe Captivate with other applications: You can use get/set variables in Adobe Captivate from other applications.

Create a user-defined variable

  1. Select Project > Actions.

  2. Select the Variables tab.

  3. In the Type menu, select User.

  4. Click Add New, and enter the following information:

    Name
    Specify a unique name for the variable. Ensure that the name is intuitive enough to help users guess its content. For example, a variable storing the version number of a product would have the name ProductVersion or VersionNumber.

    Value
    Specify a value for the variable. The value that you specify occurs at all instances of occurrence of the variable in the document. You can also choose to set the value later by leaving this field blank. Variables with undefined values appear as blank spaces in the project.

    Description
    Optionally, add a description for the variable. For example, you could add a note for the authors instructing them about when to use the variable.

  5. Click Save.

Some of the variable names are reserved by ActionScript. Do not use the following variable names when creating your variable: abstract, as, boolean, break, byte, case, cast, catch char, class, const, continue, debugger, default, delete, do, double, dynamic, each, else, enum, export, extends, false, final, finally, float, for, function, get, goto, if, implements, import, in, include, instanceof, interface, internal, intrinsic, is, long, name, namespace, native, native, new, null, override, package, private, protected, prototype, public, return, set, short, static, super, switch, synchronized, this, throw, throws, to, transient, true, try, type, typeof, use, var, virtual, void, volatile, while, with.

Customize a system variable

  1. Select Project > Actions.

  2. Select the Variables tab.

  3. In the Type menu, select System.

  4. In the View By menu, select MovieMetaData.

  5. Select the variable that you want to modify, and change its value. For example, to assign the name of your company to the cpInfoCompany variable, select it from the list. In the Value field, enter the name of your company.

  6. Click Update.

Edit/delete a user-defined variable

  1. Select Project > Actions.

  2. Select the Variables tab.

  3. In the list of variables, select the variable you want to edit.

  4. Do one of the following:

    • To edit the variable, modify the value/description of the variable, and click Update.

    • To delete the variable from the list, click Remove.

Note: You cannot delete system variables or variables that are being used by text captions. Removing a variable referenced by an action resets the action to Continue.

Controlling Adobe Captivate projects with variables

You can control Adobe Captivate projects with variables that you can set on the Timeline. Controlling a project with variables is useful if you want to create custom SWF playback controls or if you are putting a project into a FLA file.

Using variables is an advanced feature that should be implemented only by users with a solid background in Flash.

To control the project through the skin file, add the prefix cpSkinLoader_mc to the variables.

The following commands are used by playback controls and preview:

rdcmndPrevious
Set to 1 to go to the previous slide.

rdcmndNextSlide
Set to 1 to go to the next slide.

rdcmndPause
Set to 1 to pause the project.

rdcmndResume
Set to 1 to resume showing a paused project.

rdcmndRewindAndStop
Set to 1 to rewind and stop the project.

rdcmndRewindAndPlay
Set to 1 to rewind and play the project.

rdcmndGotoFrame
Go to a specific frame.

rdcmndExit
Set to 1 to exit.

rdcmndInfo
Display the information window.

The following variables provide information currently used by playback controls and preview:

rdinfoFrameCount
Total number of SWF frames in the project (this is not the number of frames in the main Timeline, but the sum of all slide frames).

rdinfoCurrentFrame
Current frame (goes from 1 to rdinfoFrameCount when you play the project).

rdinfoCurrentSlide
Slide currently playing (zero based).

rdinfoSlideCount
Number of slides in the project (not including hidden slides).

rdIsMainMovie
Can be used to identify whether the SWF file corresponds to the main Adobe Captivate project.