EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 33

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Syntax 33
To create a comment block, place /* at the beginning of the commented lines and */ at the end.
For example, when the following script runs, none of the code in the comment block is executed:
// The code below runs
var x:Number = 15;
var y:Number = 20;
// The code below doesn’t run
/*
on(release) {
// create new Date object
myDate = new Date();
currentMonth = myDate.getMonth();
// convert month number to month name
monthName = calcMonth(currentMonth);
year = myDate.getFullYear();
currentDate = myDate.getDate();
}
*/
// The code below runs
var name:String = "My name is";
var age:Number = 20;
Keywords
ActionScript reserves words for specific use within the language, so you cant use them
as identifiers, such as variable, function, or label names. The following table lists all
ActionScript keywords:
Constants
A constant is a property whose value never changes.
For example, the constants
BACKSPACE, ENTER, QUOTE, RETURN, 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) {
alert = "Are you ready to play?";
controlMC.gotoAndStop(5);
}
break case class continue
default delete dynamic else
extends for function get
if implements import in
instanceof interface intrinsic new
private public return set
static switch this typeof
var void while with

Table of Contents

Related product manuals