A function will work right only if you use the correct syntax. The syntax of a function includes the function's arguments. Almost every system function requires arguments, which supply the function with the information it needs to carry out its task. For example, when you use the SQRT function, you need to supply the function with the number you want the square root of.
The most detailed description of a function's syntax appears in System Functions. Authorware also displays the syntax of each function in the first line of the description in the Functions dialog box.
There are two types of arguments: required and optional. Optional arguments are enclosed in brackets ([ ]). Not every function has optional arguments.
The best way to get the syntax right is to select a function in the Functions dialog box and then paste where you want to use it. Then replace the argument names in the template syntax with the values you actually want to use. For example, if you want to make sure that the name you're storing in the variable UserName is capitalized, first type:
UserName :=
Then paste in the Capitalize function, like this:
UserName := Capitalize(string [,1])
Replace string with the name of the variable that contains the text the user has entered:
UserName := Capitalize(EntryText [,1])
And finally, delete the optional argument:
UserName := Capitalize(EntryText)
If you are entering a function or variable in a Calculation window, you can make sure that the capitalization is correct for case-sensitive functions by setting the properties in the Calculation window to automatically correct the system functions and variables case. This is normally not necessary, however. When you close the calcluation icon, the next time you open it, you will see the correct case. For details, see Changing calculation defaults in the Calculation window.
For example, if you want to capitalize the name a user has entered, you'd set up the variable Name, where you're storing the capitalized name, before you paste the Capitalize function.
For example, you could use the GetNumber function to get an old score you've stored in a string, compare it to a user's current score, and then branch depending on whether the current score was lower or higher than the current score. The expression would look like this:
You'd set up the variable Score (which contains the current score) and the relational operator that performs the comparison before you pasted the function in the field.
If you don't know which category the function is in, select All.
The syntax and arguments for each system function are listed and defined in the Functions dialog box.
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/authorware/7/using_aw_en/09_var37.htm