Advanced Actions allow you to execute some complex tasks and workflows in the Captivate project when an event is triggered, or when certain conditions are met.

Assets and samples

The procedures in this document require you to use assets such as images and sample Adobe Captivate project files. You can choose to use your own assets and samples. However, it is recommended that you download and extract the following zip file to your computer:

advanced-actions.zip

 

Before explaining Advanced Actions, some basic concepts which are useful to understand Advanced Actions are covered.

What are literals?

Literals are fixed values. A literal can be either an alphanumeric value, or it can be a number. For example, in real life, John, Sarah, 100 are literals as they are fixed values.

And, for a string literal, like “John”, if you use it with any function in conventional programming, the value of the literal changes. If you want to reverse the literal above, use “John”.reverse().

What are variables?

Variables are entities whose values can change. For example, in real life, if 'color' is considered a variable, red, blue, and green are some of the values logically associated with that variable. So variables can be considered as placeholders for different values.

System variables and user variables

Variables in Captivate can be classified into system variables and user variables. Following is a brief description of them.

System variables

System variables are pre-defined variables in Captivate.

For example,

  • cpInfoCurrentDate is a system variable which shows the current date that is set on the user's computer.
  • cpInfoAuthor returns the name of the author as specified in the properties of the project (File > Project Info).

User variables

User variables are defined by the user. These variables can also be made to accept a set of values, and reject the other entries.

For example, you can define a variable 'fruit' to accept fruits as values. You can also restrict the values accepted by the 'fruit' variable by specifying that the entries be one of apples, oranges, grapes, or bananas. This helps you in collecting values in the variable which are of interest to you.

Note:

When you add a Text Entry Box to the slide, Captivate automatically assigns a variable to it.

To learn more on variables, see the article Adobe Captivate variables.

Creating user variables

You can create user variables in your Captivate project by choosing Variables in the Project menu. This opens up the Variables dialog box. To create a new user variable, click open Add New to the right of Type drop-down box. It's a good practice to name the variables in a way which helps you identify its function later on. You can also enter an initial value to the variable in the Value field.

variables_dialog
Variables

Note:

In Captivate, system variables cannot be modified or deleted, and user variable names cannot be changed once created.

Rules and conventions for naming variables

The name you assign to a user variable must not conflict with Captivate’s internal functions, reserved keywords, exposed system variables, or other hidden variables.

There are some conventions while naming a variable. They are:

  • Do not begin the name with a blank or a digit.  

Example: Naming variables as 1Name, _Name is a bad practice.

  • Do not use any reserved keywords. 

For example, avoid using the keywords like: class, while, case, float.

  • Use unique variable names. 

Example: MyVar1, MyVar2

  • Use intuitive names for a variable. 

Example: Input_Name, Display_Education

  • Always add descriptions to a variable. 

Example: Input_Name variable accepts name entered by the candidates.

To see the list of reserved keywords in Captivate, see the article How to create user-defined variables in Adobe Captivate.

Advanced Actions

An Advanced Action allows you to execute an action when an event is triggered, or when a condition or set of conditions are met.

Advanced Actions User Interface

To open Advanced Actions, go to Project menu, Advanced Actions. You get the user interface shown below. 

aa_ui
Advanced Actions User Interface
Label Description
1 Name of the action.
2 Enable this check-box to make the action conditional.
3 Action items.
4 Choose an existing action.
5 Preview the structure of the action.
6 Create an action.
7 Import a shared action.
8 Export a shared action.
9 Delete an action.
10 Duplicate an action.
11 Add an action item.
12 Delete an action item.
13 Copy an action item.
14 Cut
15 Paste
16 Insert
17 Move up.
18 Move down.
19 Decision group.
20 Add a decision.
21 Remove a decision.
22 Duplicate a decision.

Standard Actions

Standard actions allow you to execute an action when an event is triggered.

Example- Project to welcome candidates to the course

As an example, implement a Standard action to welcome the users when they enter their name in the course you create.

  1. Open a blank project and add a content slide.

  2. Add a text entry box and a text caption from the Text menu.

  3. Delete the Submit button which opens up along with the text entry box and add a standard button. This is done so because the button which comes along with the text entry box cannot be hidden from the slide during runtime. Rename the added standard button as Submit.

  4. Edit the text caption as Enter your name in the box below and press enter to start the course.

  5. Select the text entry box, go to the Properties Inspector, Properties tab, Style section and click the [X] icon against Variable to open the Variable Name dialog box.

    standard_action-addvariable
    Text entry box Properties
  6. In the Variable Name dialog box, enter the variable name as Candidate_Name. You are not just creating a variable but also associating the variable with the text entry box by doing this step.

  7. Add two text captions to the slide from the Text menu. Make both these captions invisible in the output by using the eye icon left to the caption name under the Properties tab of Properties Inspector.

    Rename one of these captions as Welcome to the course,

  8. The second text caption added to the slide in the previous step will be used to call the variable Candidate_Name to display the name entered by the user. Click into the text caption to enable the Insert variable [X] button in the Properties Inspector, Properties tab, Character section under Style.

    In the Insert Variable dialog box, select the variable Candidate_Name against the Variables drop-down list.

    When you do this step, the default text caption changes to $$Candidate_Name$$ to denote that the Candidate_Name variable is called from this text caption.

    Note:

    You can also call the variable by directly changing the text of the caption to the variable name and preceding and succeeding it by $$. But best practice to call the variable is by clicking the [X] icon and opening the Insert Variable dialog box as this allows you to control the maximum length of the variable value to be displayed.

  9. Select the text entry box added in step 2, go to Properties Inspector, Properties tab, Actions section, and in the On Success drop-down list, select Execute Advanced Actions.

  10. Click the folder icon against the Script drop-down list below On Success to open up the Advanced Actions dialog box. Enter the actions in the image below by clicking into the rows of the dialog box, and enter the Action Name as AdvAction_Show_Name.

     

    standard_actionslogic
    Standard Actions
  11. To view this project in action, run preview.

Conditional Actions

Conditional actions, as the name suggests, are executed only when a condition or set of conditions are met.

Check the Conditional Tab in the Advanced Actions dialog box to set the condition and the corresponding action.

If..else logic

If..else logic is:

  1. If a condition or set of conditions are met, execute an action.
  2. Else (if the condition or conditions are not met) execute another action.

As an example, you can set up a conditional action to display a text caption to welcome a candidate if their age is greater than 15, and to display a deny-entry caption otherwise.

if_else_logic1
If..else logic (If interface)
if_else_logic2
If..else logic (Else interface)

While logic

While logic is a conditional loop that evaluates a condition at the beginning of a statement, and continues to loop a set of actions until the condition or set of conditions is true or false.

As an example, you can set a criterion for an eLearning course eligibility that while the candidate is a graduate and their experience is greater than or equal to 5 years, accept the candidate.

while_logic
While logic

Example 1 - Project to share facts about planets in the solar system

This project implements conditional actions to share some interesting information about the planets in our solar system.

  1. Open a blank project and add nine content slides. Delete the default title slide.

  2. Add three text captions and a text entry box to the first content slide.

    1. Rename the three text captions as Know your planets, Enter the name of a planet below to get some interesting information, and Check the spelling and try again! respectively.
    2. Make the caption Check the spelling/case and try again! invisible during runtime by using the eye icon next to its name under the Properties tab of Properties Inspector.
    3. Select the text entry box, go to Properties Inspector, Properties tab, Style section, and deselect Retain Text.  
    4. Also, click More Options below Retain Text and select Allow All.
    5. Click the [X] icon under Variable and create a variable named Input_Planet for readability.
    6. Also, add the image of the solar system to this slide given to you.
    7. Resize and reorient the elements. You can also format the text captions for visual appeal (see the image below).
    solar_system_screenshot
    Solar system
  3. In the second slide, add a rectangle from the Shapes menu, a text caption from the Text menu, and a button from the Interactions menu. 

    1. Change the opacity of the rectangle to 0%. To change it, go to the Properties InspectorProperties tab, Style section, Fill
    2. Enlarge the rectangle into a border for the slide.
    3. Move the button to the upper-right corner of the border. This button will act as the close button.
    4. Change the caption of the button to X to denote the closing symbol. To change it, go to the Properties InspectorProperties tab, Style section, Caption.
    5. Also, for the button, in the Actions section in the Properties tab, select On Success as Jump to slide and the Slide as 1 slide 1.
    6. Add the image of Mercury given to you, to the slide. 
    7. Add the facts about Mercury from the Planets.docx document given to you, into the text caption.
    8. Rename the image as Image_Mercury, text caption as Text_Mercury, and the rectangle border as Border_Mercury for readability.
    9. Align all the elements you added to the slide. (See the image below).
    10. Select this slide in the Filmstrip and in the Properties InspectorProperties tab, Actions section, choose On Enter as Hide Playbar.
    mercury_slide_screenshot
    Slide for Mercury
  4. Repeat step 3 to add a planet each to the rest of the slides. In the sample project given to you, the planets have been added in sequence according to their distance from the sun. Make sure to rename the elements added to the slide appropriately.

  5. Create a condition that if the users enter a planet name, they are taken to the slide which contains that planet's information. And if they enter the spelling incorrectly or doesn't start the name in uppercase, an error message is displayed.

    To achieve this logic, an Advanced Action has to be set up for the text entry box added to the first slide.

    1. Go to the first slide and select the text entry box.
    2. In the Properties Inspector, Properties tab, Actions section, select On Success as Execute Advanced Actions.
    3.  Against the Script drop-down below Execute Advanced Actions, click the folder icon. The Advanced Actions dialog box opens up.
    4. In the Advanced Actions dialog box, check the Conditional Tab.
    5. Enter the IF condition, and the corresponding action. In this case, if the user enters Mercury, jump to the second slide. (See the first image below in this step)
    6. Similarly, set up the condition and the corresponding actions for the other planets in separate tabs Untitled-1 to Untitled-8. By default only three tabs are present; so manually add more tabs.
    7. In the ninth tab, enter the condition to display the error message. The logic is that if none of the planet names are entered correctly, or if the name doesn't start in uppercase, an error has to be displayed. Also add a second action in this tab to jump to slide 1; this automatically refreshes the Submit button during runtime. (See the second image below in this step). 
    advanced_action_logic1
    Conditional Actions (Interface 1)
    advanced_action_logic2
    Conditional Actions (Interface 2)
  6. Select the first slide in the Filmstrip, go to Properties Inspector, Properties tab, Actions section, and select On Enter as Hide. In the Hide drop-down, select the text caption which contains the error message. This removes the error message when the user enters the first slide for exploring more planets, after a sequence of bad and successful attempts.

  7. To see the project in runtime, preview the project.

Example 2

In this example, when you click a button an object disappears, and reappears when you click the button again.

Perform the following steps:

  1. Declare a variable myVar with value equal to 0.

    declare_a_variable
  2. Create an Advanced Action B1 where:

    1. If the value of myVar is equal to 0

    2. Then hide the object and assign the value of myVar to 1.

      hide_and_assign_valuetoavariable
    3. Else show the object and assign the value of myVar back to 0.

      else_statement
    4. Save the action and preview the project. You can see that when you click the button the object disappears, and appears again when you click the button again.

Advanced Actions using JavaScript

In this example, when you click a button, an Advanced Action containing a piece of JavaScript code executes producing the desired result.

Launch the Advanced Actions dialog box and assign Execute JavaScript as action and write the following snippet in the Script_Window to get the current frame of the movie:

alert(window.cpAPIInterface.getCurrentFrame());
advanced_actionsjavascript
Advanced Actions using JavaScript

When you preview the above Advanced Action on a browser, you get the result as follows.

advanced_actionsjavascriptpreview
JavaScript output

For more information, see Common JavaScript interface of Captivate.

Shared Actions

If you want to use an Advanced Action in other parts of the same project, or in a different project, you can save it as a Shared Action.

For example, as an eLearning author, you have to repeatedly use an Advanced Action to welcome the candidates to the courses you create. Let's save the Advanced Action created in the section Standard Actions as a Shared Action and open it in a new project.

  1. Open the project created in the section Standard Actions.

  2. Open the Advanced Actions dialog box and open the existing action AdvAction_Show_Name.

  3. Save it as a Shared Action by clicking Save As Shared Action button at the bottom of the dialog box. The Save as Shared Action dialog box opens up.

  4. In the dialog box, name this Shared Action as SharedAction_Show_Name. You can see that all the elements involved in AdvAction_Show_Name show up under Parameter Values. Enter a description against each parameter to identify its function. Description is important to understand the purpose of these parameters when you use them later. Also give a description to the Shared Action. Save the Action (see the image below).

    shared_action
    Save As Shared Action
  5. In the Advanced Actions dialog box, click the Export icon in the upper right corner (see the image below). It opens the dialog box for you to save the action as a file on to your device.

    shared_action-export
    Export icon
  6. Open a blank project, go to the Project menu and open Advanced Actions.

  7. Click the Import icon in the upper right of the Advanced Actions dialog box. Browse and locate the saved Shared Action file and import it.

    shared_action-import
    Import icon
  8. Repeat steps 1 - 8 of the section Standard Actions and customize the names of the added elements.

  9. Select the Text Entry Box and go to the Actions section under Properties tab of Properties Inspector. Select On Success as Execute Shared Action. There is a {P} icon against this option. Click this icon and it opens up the Shared Actions Parameters dialog box.

    imported_shared_actiondialog
    Shared Action Parameters (unfilled)
  10. Supply parameter values to the imported parameters. Parameter values to be entered are the elements you added to the new project. By doing so, you are associating the elements in the new project with the Shared Action.

    imported_shared_actiondialog-parameterized
    Shared Action Parameters (filled)
  11. To see the Shared Action in runtime, preview the project.

For more information on Advanced Actions, see the article Advanced actions in Adobe Captivate.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy