Wednesday, April 18, 2012

Lectora Best Practices Part 2 - Variables and Actions

By Joseph Suarez

This post is Part 2 in a series intended to list some ways to use Lectora that avoid problems, reduce development time, and make development easier overall. In Part 1, we covered how to optimize Lectora preferences for best performance. Now, we’ll go over handling variables and actions.

Use a variable and action naming system consistently
Newer versions of Lectora name actions according to what they do, which is definitely better than nothing, but “OnMClkGoTo” isn’t always as insightful as “on click go to next page” or even “next page.” Choosing to name your actions and variables something short, understandable (to all developers), and consistent enables the ability to read through actions listed in the Title Explorer like lines of code without having to open the properties window.

Since Lectora lists objects and variables in alphabetical order, one popular method is to begin your variable names with an underscore (_). This lists your variables at the top, separating them from Lectora’s reserved variables. It also helps to start variables (and most Lectora objects) with a common first word, so they are easier to find listed together. For example use “_quizPass” and “_quizFail” instead of “_passQuiz” and “_failQuiz.”

Avoid adding an action onto a button’s “On Click” tab
Every button in Lectora has an “On Click” tab in its properties where a single action can be applied. While this is perfectly acceptable and functional, it can lead to development problems. Instead, add actions onto the object itself in the Title Explorer, just like you would any other object without the “On Click” tab such as an image or text box. This has the following advantages for easier development and maintenance:
  • Quickly see which buttons have (or don’t have) actions in the Title Explorer instead of opening each one and looking at the “On Click” tab.
  • Avoid confusion between both “On Click” tab actions and those added onto the object.
  • Can easily be expanded to have more than 1 action
Always add “Go to” actions last
If you’ve been using Lectora for any length of time, you’ll have noticed preview mode is much different than publishing to HTML. One subtle difference is the placement of “Go to” actions. For example, let’s say you have a button with two actions attached to it: one that modifies a variable and another linking to the next page (the “Go to” action). In preview mode, the link can occur first and the variable is still modified. However, in HTML the link occurs first taking the learner to the next page before any other actions occur, so the variable isn’t modified.

Lectora didn’t necessarily do anything wrong, that’s just how HTML, JavaScript, and web browsers work. For this reason, always place “Go to” actions last (at the bottom) of a series of actions.

Never attach AICC/SCORM completion status and scoring actions to the course exit button
Whoever handles phone calls to troubleshoot courses not completing in your organization’s LMS will thank you for following this simple best practice. Never attach any action tied to communication with an LMS, such as scoring and completion status, to a button. If possible, have them fire when the page first loads. While it may seem perfectly fine to add them to a button exiting the course, it risks the course exiting before the actions fire or the communication with the LMS completes.

Take advantage of Lectora’s own “Reserved” variables
Aside from creating your own variables, Lectora has a useful set of reserved variables attached to every course. Although they cannot be altered, you can use them to pull information into your course such as the date, time, learner name, etc. There’s also reserved variables used to keep track of the current page, chapter, and section including the name, number, and total number of each. Knowing these are at your disposal can prevent you from trying to reinvent the wheel with a complicated series of actions and variables.

Use actions and variables to display objects dynamically
If every page of your course has a page text header displaying the current page name, you can save some time and just place a single text box at the top of your title. This way, you can use a “change contents” action to change the text header of every page to display the reserved page name variable “CurrentPageName,” which is whatever you named the page in the Title Explorer.

That’s just one example of how using actions and variables can dynamically affect objects. Other examples include using show and hide actions to restrict the next button from appearing and using reserved variables to create a “smart” next button.

No comments:

Post a Comment

Thank you for your comments.

Post a Comment