Author: steve happ | Email
Website : www.video-animation.com
Advertisement
DataTypes (AS 2.0 only)
Variables in AS 2.0 can be given strict datatypes such as a Number or a String or a Boolean.
e.g.
var myNum:Number;
var myString:String;
var isTested:Boolean;
In AS 1.0 there is no strict datatyping. A number can become a String and vice versa.
e.g.
num = 10;
num = "Test";
Strict datatyping can capture errors.
Compiler Errrors
- Syntax errors - e.g. var numberOne:
- Spelling Mistakes - var mc:MoveiClip;
- DataType Errors - (AS 2.0)
var num1:Number;
var str1:String;
num1 = "Steve";
str1 = 27;
Flow control
IF
An if statement tests a condition. If it is true, then a set of actions is executed.
Otherwise, the set is ignored or bypassed. Here is a template :
If(expression){
Statement1;
}
Here is an example :
var x = 23;
if(x>3){
trace("x is greater than 3");
}
We hope the information helped you. If you have any questions
or comments, please don't hesitate to post them on the
Forums section
Submit your Tutorial at Click Here