Have you never used ActionScript before, and want to learn? This article will help you get started. Have you used only ActionScript 1.0, and wonder what changed with version 2.0? Keep reading to find out.
What is ActionScript? - Curly Braces (Page 2 of 5 )
ActionScript event handlers, class definitions, and functions are grouped together into blocks with curly braces ( {}).
Ex: // Class Form.as
class Form() {
}
// onRelease Event handler for button
go_btn.onRelease = function() {
};
// Function
function getData(name:String):Void {
}
Comments:
There are two ways you can write comments in ActionScript, single line and multi-line comments.
Ex:
// This is a single line comment
/*
This is a multi-line comment with two lines…
second line goes here…
*/
Constants:
ActionScript contains predefined constants.
For example, the constants ENTER, BACKSPACE,SPACE, and TAB are properties of the Key object and refer to keyboard keys. To test whether the user is pressing the Enter key, you could use the following statement:
if(Key.getCode() == Key.ENTER) {
}
Flash does not enforce constants; that is, you can't define your own constants.