Accessibility
[an error occurred while processing this directive]

Community Publishing

Created:
2010-10-04
Last Updated:
2010-10-06
by
User Level:
Beginner
Products:
Adobe Captivate


Need more tips and tutorials?


Unleash Power of Variables in Captivate (4&5) with Advanced Actions


This article is not meant for power users but as an introduction to the use of Advanced actions for controlling system variables and user variables. I suppose that you have read and 'absorbed' the terminology and techniques for variables described in this first article:Use Power of Variables without Advanced actions. The article you are reading for the moment is also a basic introduction to advanced actions, both standard and conditional.

1. Goal


I would like to explain how you can extend the possibilities of working with variables, using Advanced actions, using practical examples. Screenshots will be taken in Captivate 5, but most of the examples can be worked out in Captivate 4 too. If there is a difference or limitation, I will explain.

 

2. What is an Advanced action?

You already worked with actions in Captivate. Some examples:

  • Continue: this is the default action when Entering a slide
  • Go to the Next slide: this is the default action when Exiting a slide
  • Assign: the action we used in the first article to change the value of a variable when a button is clicked

In this examples you see that the action is triggered by an 'event'. Events here are: Entering/Exiting a slide, Clicking a button. By default you are limited to one unique action to be performed when an event occurs. Since the number of events are somehow limited, it happens that you want to have multiple actions to be executed by this event. An example: on Entering a slide you want to Increment (another action) a counter AND to Show (=action) a formerly hidden Text Caption. CP4-users will now be happy, because they can assign Multiple Actions to an event, but... I experienced some issues with that feature. Multiple actions will not always work as they should. So even for CP4-users I would strongly recommend the workflow always to be used by CP5-users:

Use an Advanced (Standard) Action when you need an event to trigger multiple actions!

An Advanced (Standard) Action is really a sequence of actions. You will recognise most of those actions because they can also be assigned as unique actions to an event. However some actions will seem to be missing because they are replaced by more powerful ones, which you will not recognise at once. 

Some more complicated actions cannot be realized with the actions available in the lists you can assign as a unique action to an event. A practical example: you want to create a toggle-button to show/hide the playbar. This means that when you click the button, and the playbar is visible (cpCmndShowPlaybar=1), you want this system variable to be changed to the value=0. If the playbar is invisible (cpCmndShowPlaybar=0), you want it to be changed to 1. This can only be done using this 'formula':              cpCmndShowPlaybar = 1 - cpCmndShowPlaybar
Solution is to create an Advanced action too, that will (perhaps) have only one statement. This kind of formula in Captivate 5 is called an Expression, In version 4 it will be achieved using Assign. But using the Assign action for this kind of formula is only possible in an Advanced action. That is why I prefer the new 'Expression' because it is less confusing.

Use an Advanced (Standard) Action when you need an event to change the content of a variable with an Expression!

If you want to check a condition and to execute a different bunch of actions depending on the result of that condition, you need to create an Advanced (Conditional) Action. In paragraph 6 I a basic Conditional action is constructed. I have published several articles about usecases for that kind of actions.

Use an Advanced (Conditional) Action when you need an event to trigger different sequences of multiple actions, based on one or more conditions!

It is also possible to combine standard and conditional actions. The workflow is explained in another article Standard and Conditional in one Advanced action.

 

3. Example

Please watch this movie: it has 4 slides

  1. Slide DateChoice: you can choose the way to represent a date by clicking one of three buttons (US, Europe, ISO). Such a click will show an example for the current date, but also how long you are already playing with this project and how many times you have been clicking a button. When you want to go on, click on the button 'OK, I have decided' that is emphasized by a surrounding, blinking rectangle. This is the slide where you will practice Advanced Actions.
  2. Slide US_Slide is the slide you will jump to if you choose for the way dates are presented in the US: month/day/year. From this slide you can return to the first slide by clicking on it (has a click box covering up the slide).
  3. Slide Europe_Slide is the slide you will jump to if you choose for the way dates are presented in Europe: day/month/year. From this slide you can return to the first slide by clicking on it (has a click box covering up the slide).
  4. Slide World_Slide is the slide you will jump to if you choose for the way ISO tells us to write dates: year/month/day. From this slide you can return to the first slide by clicking on it (has a click box covering up the slide).

Content on this page requires a newer version of Adobe Flash Player.



Get Adobe Flash player

The system variables and user variables used in this example are: 

Variable Type What?
cpInfoCurrentDateString system shows date in US-way: 10/4/2010
cpInfoCurrentYear system current year: 2010
cpInfoCurrentMonth system current month: 10
cpInfoCurrentDate system current day: 5
cpInfoTimeElapsedMS system time since opening SWF, in milliseconds
v_choice user will store last choice: US, Europe or World
v_clicks user will count number of clicks
v_TimeSec user calculated time since opening project in seconds

 

The first slide DateChoice has several Advanced Actions, triggered by different events:

Advanced Action Type  Event
Init Standard On Enter (Slide)
US Standard Click on button 'US'
Europe Standard Click on button 'Europe'
ISO Standard Click on button 'ISO'
JumpChoice Conditional On Exit (Slide)


4. Advanced (standard) action "Init"

This action is triggered when entering the first slide, DateChoice.

The first has those Text Captions and buttons, from top to bottom:

  • Transparant Text Caption labeled Question: "How do you ...." that is always visible.
  • Three Text Captions, with same size and position in style Platinum, labeled USA_Date, Europe_Date, ISO_Date that are initially invisible; because the user can return to this first slide, you have to hide them (again) when entering the slide.
  • Three text buttons, labeled Btn_US, Btn_EU, Btn_ISO; they are always visible
  • Text Caption, style Platinum, labeled TimeCaption, that will show the elapsed time in seconds; this caption is initially invisible and has to be hidden when (re-)entering the slide.
  • Text Caption, style Platinum, labeled ClickNumber, that will show the number of clicks; this caption is initially invisible and has to be hidden when (re-)entering the slide.
  • Text button, labeled Btn_Decision ('OK, ...') that is surrounded by a rectangle (only stroke, no Fill - rectangle will blink); this button is initially invisible and has to be hidden when (re-)entering the slide. The action on Success is the default action 'Continue'. 

This advanced action Init only uses Hide statements as you see in this screenshot:

Action Init

 Tip:If you prefer to reset the counter for the number of clicks when the user re-enters this first slide, you can add the statement             Assign v_clicks with 0

 

5. Advanced (standard) actions "US", "Europe" and "ISO"

Those actions are triggered by the corresponding buttons Btn_USBtn_EUBtn_ISO.  

The three actions are very similar, use the duplicate functionality of the Advanced actions dialog box and edit the duplicates. I explain the sequence of statements for the action US:

  • Only the Text Caption USA_Date must be visible, both Europe_Date and ISO_Date must be hidden; this is necessary because the user can click as many times as he want; you know already the Hide statement, here you will use also the Show statement.
     
  • Next you will increment the counter v_clicks;  the increment statement that you can use when indicating singular actions is not available in the dialog box! CP5-users, watch how this is replaced using the Expression statement.
                                                                           Expression     v_clicks = v_clicks + 1
    CP4-users: your code will be                 Assign v_clicks with v_clicks + 1
     
  • The number of clicks is recalculated, so you can Show the text caption ClickNumber, this sequence is important!
     
  • If you have read the article on variables, you will perhaps remember a suggestion about making your users nervous by showing the system variable cpInfoElapsedTimeMS? This time we will use the statement Expression to calculate a user variable v_TimeSec from the system variable.
     
  • When the time is calculated, we can show the Text caption; again, this sequence is important, you cannot reverse those two statements!
     
  • The chosen date style will be used later on to jump to a corresponding slide. We have to store the choice in the user variable v_choice; the content of this variable will change with every click on a button, but it is the last value before exiting the slide that will decide about the jump to slide. Watch the used statement Assign
     
  • Indeed, Apply Effect is possible! You choose the object, in this case the Effect 'Blink Twice' is applied to the surrounding rectangle; the duration of this effect has not be changed.
     
  • And with the last statement the hidden button Btn_Decision is made visible while the blinking is executed with the statement Show.
     

Action US

 

6. Advanced (conditional) Action "JumpChoice"

This action is triggered when exiting the first slide, DateChoice

Since we have 3 possibilities for the jump action, we need 3 decisions to evaluate the content of the user variable v_choice. In the screenshot they are labeled World, Europe and US:

  • If the content of the variable is 'World' (see this decision in the screenshot), the user will be directed to the fourth slide, labeled World_Slide
  • If the content of the variable is 'Europe', the user will be directed to the third slide, labeled Europe_Slide
  • If the content of the variable is 'US', the user will be directed to the second slide, labeled US_Slide

I do not use the 'Else' region, so I did not show this region of the dialog box. 

If you want a more detailed intro to conditional actions, here is a video tutorial: Create Customized Feedback

 Action JumpChoice

If you tried to replicate the usecase, to finish it you will have to add a Click box on each of the slides US_Slide, Europe_Slide, World_Slide and make this Click box cover up the slide. The action 'On Success' for this Click box is always the same: 'Jump to slide DateChoice' (= first slide).

 

7. Conclusion

Hope that the usecase I explained gives you some ideas about using variables in combination with actions. Here are two other ideas that you could work out:

  • On Question slides you can assign an Advanced action on Enter (not on Exit) of the slide. Create an advanced action that calculates the number of questions that are left (using the system variable cpQuizInfoTotalQuestionsPerProject and a user variable that will count the number of questions that already are answered). Show this information in a Text Caption, together with the already scored points (cpQuizInfoPointsScored).
  • If you have imposed a time limit on an assessment, create an Advanced action that will show the time spent and the time left.

 

 

 

 

 

 

 

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License