December 13, 2002   Tip of the Week Mailing List
The Tip

I have found that I return to the Help section, "Using Variables, Functions, Xtras, and More > How Authorware evaluates expressions," over and over. Because Authorware does not use strict variable types (a variable can contain 1, then "a", then ["cat", "dog", "horse"]), sometimes it does not evaluate your expressions exactly as you might think.

By knowing exactly how expressions do evaluate, you can save yourself a lot of hassle. You can even use Authorware's oddities creatively. For instance, this week on the Aware List, someone had a problem with the expression "My string containing the number 2." <> 2. This is because Authorware saw a number on one side of the operator, and so only looked at the number. The Help file says it like this:

If you use a character string (or character string variable) in a mathematical expression, Authorware interprets the variable as a numerical value. If the character string begins with a number, Authorware extracts the number.

Another little known quirk is that Authorware interprets the strings "T", "On", "True", and "Yes" as the Boolean True. I like to use icon titles to set variables, and I find it much easier to read "Turn MyButton on" than "MyButton = 1". The contents of a calc entitled "Turn MyButton on" might read something like MyButton := GetWord(WordCount(Icontitle), Icontitle). I can use copies of the icon throughout the piece, turning the button on and off by simply changing the last word of the icon's title.

Note that the variable will still contain the value "on" or "off." Even though Authorware evaluates the variable as if it were a 0 or a 1, it still contains the string you assigned to it. If you want it to contain a 0 or a 1 from reading in the icon title, you would wrap the Getword expression in Eval().



 
Did you know?

You can move labels in the button editor to offset them from an imported graphic. This can be especially useful if you want to set up Tool Tips without a lot of extra coding. Simply select the "Show Label" option for the Over state of the button, then drag the label beneath the graphic.



 
Tip of the Week on vacation

I am taking a break from Tip of the Week for a couple of weeks while I move my household and celebrate the holidays. I wish you and yours a joyous holiday season.


Site Updated

I've been hard at work on my first major contract, so I have neglected to post that I updated the website last weekend. The chat log is now up to date, and the Tip of the Week archive now includes all tips except this one.

I happened to notice as I began writing this newsletter that there are now 99 subscribers! There have been 11,188 hits to the main page since March. I'm sure a numerologist would have a field day with those numbers.



  http://www.Authorware-Amy.com