Note:

To know more about Captivate (2017 release) and its features, download the training project, and experience an enhanced hands-on learning. 

Download the following projects:

Using Advanced Actions in Captivate

If you want to create an engaging and interesting eLearning project, look no further than advanced actions in Captivate. With advanced actions, you can create both complex and simple event-based interactions based on one or multiple conditions.

You can use advanced actions with system and custom variables, text entry boxes, mathematical expressions, quizzing, and widgets.

The scripting for the advanced actions model in Adobe Captivate is based on the Object-Event-Action model.

Events on an interactive object, such as mouse-clicks, trigger actions that are defined for that event. You can handle complex interaction scenarios by scripting your own actions and applying them to the various interactive objects. The scripting editor in Adobe Captivate helps you script custom actions for interactive objects.

Advanced actions in Captivate can be categorized into two main actions:

  • Standard actions
  • Conditional actions

Note:

In Captivate 9 and previous versions, you could choose the type of action (Standard or Conditional) from the Action Type drop-down list.

Advanced Actions in Captivate 9
Advanced Actions in Captivate 9

In the 2017 release of Adobe Captivate, there is a check-box called Conditional Tab, which when enabled gives you the option to specify a conditional advanced action.

An Advanced action can be standard, conditional, or a combination of both.

Conditional Tab check-box in the 2017 release of Captivate
Conditional Tab check-box in the 2017 release of Captivate

Standard action

Use a single script to run multiple actions in a sequence. Although the user interface provides a way to run multiple actions, it is restricted to the actions available in Adobe Captivate.

A standard action is a sequence of events that triggers one or more events. The difference between a standard action and a single action is that in a single action, you can only execute one action executed by an event.

Creating a standard action

  1. From the main toolbar, click Project > Advanced Actions or hit Shift+F9.

    Advanced Actions menu option
    Advanced Actions menu option
  2. In the Advanced Actions dialog, the following labels describe the items on the dialog.

    Advanced Action components
    Advanced Action components
    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.
  3. Assign a name to the action and create action items. As an example, create a standard action that mimics the launch of a rocket. When you click a button, the rocket takes off.

  4. On an empty slide, perform the following:

    a.       Insert an image of a rocket and assign an identifier, for example, rocket.

    b.       Insert an image of a rocket with fuel propulsion and assign an identifier, for example, rocket_fuel.

    c.       Make the object rocket_fuel invisible.

    d.       Insert a smart shape and convert it to a button. On button click event, assign an advanced action.

    e.       On the Advanced Actions dialog, hide the object rocket, show the object rocket_fuel, and apply effects to rocket_fuel, so that the rocket appears to fly upwards. See the demo below to understand the workflow.

Example 1: Standard action – Send email

In this example, when you click a button, your default mail client opens with the To, Subject, and the email body pre-populated.

On button click success, create an Advanced Action and choose the Send Mail option in the Actions panel. Enter the email parameter, example@example.com?subject=Example%20subject%20line&body=Sample%20mail%20body, as shown below:

Action to send email
Action to send email

Save the action and preview the project. When you click the button, your default mail client opens and is populated in the fields provided as specified in the email parameter.

Default email client
Default email client

Example 2: Standard action – Execute JavaScript

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

For more information, see Common JavaScript interface of Captivate.

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

alert(window.cpAPIInterface.getCurrentFrame());
JavaScript editor
JavaScript editor

When you preview the project and on clicking the button, you get the following pop-up:

Pup-up of result
Pup-up of result

Conditional action

A conditional action in the Advanced Actions panel depends on whether a statement executes if a certain condition is met. For example,

if (totalMarks<=80) {
	print(“Take the test again”)’
}
else {
	print(“Congratulations!You have passed”);
}

In your eLearning projects, you can add greater interactivity depending on certain pre-defined conditions.

Creating a conditional action

  1. From the main toolbar, click Project > Advanced Actions, or hit Shift+F9.

    Advanced Actions menu option
    Advanced Actions menu option
  2. Select the Conditional Tab check-box. When you enable the option, you can see the if-else condition blocks and the actions area. Choose any of the conditional expressions with the if statement, as shown below:

    Conditional action options
    Conditional action options
  3. In the Advanced Actions dialog, the following labels describe the items on the dialog.

    Advanced Action components
    Advanced Action components
    Label Description
    1 If block. Check the conditions in this block. For example, if a is equal to b.
    2 Action block. The actions to execute if the above condition or conditions return true.
    3 Else block. The actions to execute if the above condition or conditions return false.
    4 Decision blocks. You can combine a conditional action with a standard action. Place the standard action in a second decision block.
    5 Add a decision.
    6 Remove a decision.
    7 Duplicate a decision.
    8 Select to choose action type for if.

Conditional action – While

In the 2017 release of Captivate, when you enable the option Conditional Tab, you can see an extra action while. The while action is a pre-condition loop that evaluates a condition at the beginning of a statement, and continues to loop until the condition or conditions is true or false.

Conditional Actions
Conditional Actions

For example, use the while statement to check the validity of a user name and password. Open the Advanced Actions dialog and choose While from the Perform actions drop-down list. Assign the following:

While action
While action

Save the action and preview the project. You stay on the login page until you enter the correct user name-password pair.

Variables in conditional statements

Before moving on to examples, let us look at the concept and application of variables in conditional statements. A variable is a value that can change, depending on conditions or on information passed to the program or application. In Captivate, variables store values and you can usually change those values using advanced actions.

For example, when a=5, a stores 5 in a memory location. a retains its value until a piece of code changes the value to something else.

In Captivate, there are two types of variables:

System variables: System variables come pre-defined with Captivate. You cannot create or modify a system variable. These variables enable you to modify what your e-learning module, is doing at runtime. For example, if you assign a number to the variable cpCmndGotoSlide, at runtime, you would be taken to the slide as specified by you.

User variables: These are variables that you, the author, can create and name as you choose. User variables are project-specific.

Creating and modifying a user variable

  1. Click Project > Variables.

    Variables menu option
    Variables menu option
  2. To create a variable, on the Variables dialog box, click Add New. Type the name of the variable and assign it a value. 

    Add new variable
    Add new variable
  3. Use the variable in your project. For example, displaying the value at runtime. Insert a text component in a slide and add some text.

    Displaying value of variable
    Displaying value of variable
  4. Insert the variable and concatenate to the text above. Click Insert Variable [X] in the Property Inspector panel and choose the variable.

    Insert variable
    Insert variable

    The slide now looks, as shown below:

    Slide display
    Slide display

    The variable is enclosed by two $ signs which are special identifiers for variables.

  5. Preview the project. At runtime, you can see that the value of the variable gets displayed.

    Display at runtime
    Display at runtime
  6. To use the variable in an Advanced Action, for example, insert a button in the slide, and assign it to execute an Advanced Action on a click event.

  7. Launch Advanced Actions and provide the following information in the if-else block.

    If-else action
    If-else action

    In this Advanced Action, when you click the button and if the value of the variable is “Hello World”, then a new browser window launches the google.com search page.

  8. To modify a variable, open the Variables dialog box and select the variable you want to change. Click Update.

    Update value of a variable
    Update value of a variable

    Note:

    You cannot edit the variable's name. Edit the Value or Description fields as needed and then click the Update button.

Conditional statement: Example 1 – Toggle visibility of an object

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
    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 value to a variable
      Hide and assign value to a variable
    3. Else show the object and assign the value of myVar back to 0.

      Else statement
      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.

Condition statement: Example 2 – Checking the validity of a user name and password

In this example, if you enter the correct user name and password, you are taken to a welcome slide. If you enter an incorrect user name or password or both, you are taken to a different slide. Execute the following steps:

  1. Declare two variables, uName and pWord with the values “test” and “password” respectively.

  2. Create an advanced action, A1, where:

    1. If the value of uName is equal to “test” and the value of pWord is equal to “password”

    2. Then perform the following actions, as shown below:

      Using Then options
      Using Then options
    3. Else move to a different slide, as shown below:

      Using Else options
      Using Else options
    4. Save the action and preview the project.

Edit statements

  • When editing a script, use the appropriate icons to add, remove, copy, cut, paste, insert, or move a statement (a line of code).

  • Use the drop-down list to change the type from Variable to Literal, or the other way round.

  • To remove a decision, select the decision and then click the delete icon.

Edit/delete/duplicate Advanced Action

  1. Select Project > Advanced Actions.

  2. In the Existing Actions, select the action that you want to modify or delete.

  3. Do one of the following:

    • Use the appropriate icon at the upper-right corner to delete or duplicate the action

    • To update the advanced action, use the appropriate menu icons to update the statements and then click Update.

Manage conditional actions

  • To add a decision tab, click +.
  • To delete a decision tab, click the tab, and then click '-'.
  • To duplicate a decision tab, click the Duplicate Decision tab.
  • To reorder the decision tabs, use the Move Left and Move Right icons.
  • To duplicate the entire conditional action (all decision tabs), click the Duplicate Action icon at the upper-right corner of the Advanced Actions dialog box.
  • To preview the conditional action, click the Preview icon at the upper-right corner of the Advanced Actions dialog box.

Copy Advanced Actions

You can copy an Advanced Action into another project by copying the objects or slides associated with the Advanced Action and pasting them in the target project.

In a project, Advanced Actions can be called from various objects or triggered by many events. The following table summarizes the different scenarios and indicates whether the associated Advanced Actions can be copied:

Advanced Actions associated with... Can be copied?
Objects Yes
Slides/Question slides Yes
Question pools No
Project Preferences (Quiz Pass/Fail) No

While copying a slide or an object associated with an advanced action, ensure that you copy all objects or slides that are referenced within the Advanced Action. For example, consider that an Advanced Action "MyAction" is associated with a button. The action contains a 'Show' action that displays an image 'Flower', and a 'Hide' action that hides an image 'Mango'. Now, if you need 'MyAction' in another project, copy the slide containing the button, and the slides containing the images 'Flower' and 'Mango'. Then, paste them into the project.

If Advanced Action includes this action... ...then...
Play Audio The audio file is copied into the target project
Variables The variables are copied into the target project. If a variable configured in the Advanced Action does not exist in the target project, the variable is automatically created. If a variable exists with the same name, a new variable with the same name suffixed with a number is created.
Jump to Slide The Advanced Action is successfully copied only if the target slide is already copied into the target project.

Finding slides in which the script is used

  1. Select Project > Advanced Actions.

  2. In the Existing Actions, select the action.

  3. Click Usage.

The slides in the project that use the selected script are displayed.

Apply advanced actions to slides

  1. In the Property Inspector (Window > Properties), go to Action.

  2. Select Execute Advanced Actions.

  3. In Script, select the script that you want to run from the Action menu.

Apply advanced actions to interactive objects

  1. In the Property Inspector (Window > Properties), go to Action.

  2. In the action menu, select Execute Advanced Actions. Examples of actions are On Success, On Failure, and Lose Focus.

  3. In Script, select the script that you want to run from the Action menu.

Download sample projects

To learn more about Captivate and how you can create engaging learning content, download the following projects:

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