How to Make Dynamically Targeted Actions in Lectora

targeted actions in Lectora

Let’s talk about how to make dynamically targeted actions in Lectora.  Using the power of conditions in Lectora actions can be used to make a button that dynamically targets various objects.

Assume you have one button and three hidden images, and I want the button to show each image sequentially. First, create a variable and call it, “view” and with a value initially set to 1. This will be our “conditional variable.” When I write the first action to show image 1, I make a condition that the variable “view” must be equal to 1. The action to show image 2 has a condition of “view” = 2, and show 3 requires “view” = 3. To make matters easier, and to be able to reuse this set of actions for other purposes, I’ll create a group and put the actions in it (see Brother Jeff’s post on “Grouping Actions Together in Lectora” for more ideas).

targeted actions in Lectora

Now the button needs only two actions to show all three buttons. The first runs the action group, and the second adds “1” to the “view” variable (in order to prevent the variable going over “3” a condition can be made to only add if the variable is less than 3).

targeted actions in Lectora

The result is that the single button will show each image sequentially. Now imagine that you can also set the “view” variable based on other interactions. Another button on the page can set the “view” variable to 3 and therefore, the first press of our original button will show the third image. The possibilities for dynamic interaction should be clear.

targeted actions in Lectora

This kind of thinking can also be used for other purposes, such as the common practice of excluding a “next” button until all interactions are done. By making one “lockout” variable, and having each interaction add a letter to the variable (for example, A, B, and C), a “show next” action can be built that has a condition of “lockout” contains ABC. This way only one variable needs to be used, instead of one for each interaction. Lastly, remember to limit the addition of a letter to the variable if it already contains it, to keep the variable from getting clogged with letters. Enjoy!

targeted actions in Lectora

1 Comment

  1. I am trying to use drop down list for the conditional action. but somehow doesn’t work for me. what i am missing here?

Submit a Comment



Pin It on Pinterest