Things You'll Need:
- Adobe Flash CS4
-
Step 1
The IF-ELSE statment is read as "if some condition is true then do something, if the condition is not true, then do something else". The first line of the IF-ELSE statement is written as:
if (some condition) {
That's "if" open parenthesis, followed by the condition you want to test, a closed parenthesis, then an opening curly brace which signifies the code after that brace is to be executed if the "some condition" is true. -
Step 2
The next series of lines is the code to be executed if the condition is true. It can be a series of lines of code, a call to a function and so on. So you code now looks like:
if (some condition) {
Some code
}
When you are finished with the code that you want executed if the condition is true you simply end it with a closed curly brace as shown above. -
Step 3
Finally, although not required, we add in our ELSE statement. This gets exceuted if the condition in the steps above is false.
else {
execute this code if condition is not true
}
Just like the first part you open your code block with an open curly brace, put in your code and close it with a closed curly brace. So you final code looks like this:
if (some condition) {
code
}
else {
more code
}












