Things You'll Need:
- Familiarity with basic Flash environment
-
Step 1
Learn how to use the output window in your programming. The output window is a convenient tool that allows programmers to test the output of their programs during the development process. It is analogous to testing applications in the Windows or Unix shell. The output window is called by using the trace() command and then going to Test Movies ->Send->Output. The code
trace("trace test!")
prints the text "trace test!" to the output window. -
Step 2
Learn how to utilize global and local variables. Variables are used as placeholders for alphanumerical data. In ActionScript you can declare a global or a local variable. The global variable is available to the entire program while a local variable is used only in a specific operation. To declare a global variable write the name of the variable and the value. "balance = 100," assigns the value of 100 to the variable "balance." To declare a local variable write "var" and then the name of the variable, "var balance = 500" assigns the value of 500 to the local variable name "balance."
-
Step 3
Learn how to use comparisons. Comparisons can be used to compare two or more values and utilize the following symbols; <(less than), >(greater than), =(equal to), !=(not equal to), >=(greater than or equal to),<=(less than or equal to). To use comparisons declare a variable and declare a second one with a comparative relationship. balance_matt = 120, balance_mary > balance_matt. This states that balance_mary will always be greater than balance_matt.
-
Step 4
Learn to use mathematical operators. These operators work by using the following symbols; + (add), - (subtract), / (divide), * (multiply). To divide you simply declare a variable that carries out a division operation. divide = 4/2 (result is 2). The same structure follows for the other operators: sub = 5-3 (result is 2), mult = 4*5 (result is 20) and so on.
-
Step 5
Learn to use logical conditions. To use logical conditions you must construct a cause and effect relationship through if/then statements. To do this in Flash your script must contain the if statement and the instruction. The following code prints a statement to the output window if a condition is met.
var balance = 1300
if(balance >= 1200){
trace("Matt is richer than Mary!")
}
Since the global variable "balance" is assigned a value of 1300 the sentence will be printed to the output window.













