About Data Types - MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

Constants
A constant is a property whose value never changes. ActionScript contains predefined constants.
For example, the constants
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?";
control_mc.gotoAndStop(5);
}
Flash does not enforce constants; that is, you can't define your own constants.

About data types

A data type describes a piece of data and the kinds of operations that can be performed on it. That
data is stored in a variable. You use data types when creating variables, object instances, and
function definitions.
ActionScript has the following basic data types that you will probably use frequently in your
applications:
"String data type" on page 19
"Number data type" on page 19
"Boolean data type" on page 20
"Object data type" on page 21
"Null data type" on page 22
"Undefined data type" on page 23
"Void data type" on page 23
ActionScript also has built-in classes, such as Array and Date, that can be considered complex
data types. If you are an advanced developer, you might create custom classes. Any class that you
define using the
Variables containing primitive data types behave differently in certain situations than those
containing reference types. (See
special data types: null and undefined.
When you debug scripts, you might need to determine the data type of an expression or variable
to understand why it is behaving a certain way. You can do this with the
(see
"Determining an item's data type" on page
You can convert one data type to another using one of the following conversion functions:
,
Array()
Boolean()
In ActionScript 2.0, you can assign data types to variables when you initialize them. The data
types you assign can be any of the built-in types or can represent a custom class that you've
created. For more information, see
For more information on Flex data types, see Developing Flex Applications.
18
Chapter 1: ActionScript Basics
BACKSPACE
declaration is also considered a data type.
class
"Using variables in a program" on page
,
,
Number()
Object()
"Strict data typing" on page
,
,
, and
ENTER
SPACE
TAB
26).
,
.
String()
are properties of the Key object
29.) There are also two
instanceof
24.
operator

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flex

Table of Contents