If.

 

If's are the basic structuring code within flash.

Within 'if' you can put any number of different equations to check if anything equils anything else.

 

This is the basic struturing of 'if'.

if(){

}

The equasion goes between the brackets and the returned command is heald between the curly brackets.

To use 'if' properly you will need something to check, in this case we will use a variable called myNumber.

 

var myNumber:int=1;

if(myNumber ==1){

//trace("This works.");

}

What this is doing is it is checking if myNumber is equal to one.

 

Else.

Else usualy follows if and its there incase you want to do something if the 'if' is not what it asks for.

if(myNumber ==1){

trace("This works");

}else{

trace("Error");

}

Now if myNumber equils anything else than 1, flash will display "Error".

 

refresher.

== is equal to.

>= is greater than or equal to.

<= is less than or equil to.

> is greater than.

< is less than.

Copyright © Bane18