About Data Types - MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

About data types

A data type describes the kind of information a variable or ActionScript element can hold. There
are two kinds of data types built into Flash: primitive and reference. The primitive data types—
String, Number, and Boolean—have a constant value and therefore can hold the actual value of
the element they represent. The reference data types—MovieClip and Object—have values that
can change and therefore contain references to the actual value of the element. Variables
containing primitive data types behave differently in certain situations than those containing
reference types. (See
types: null and undefined.
In Flash, any built-in object that isn't a primitive data type or a movie clip data type, such as Array
or Math, is of the Object data type.
Each data type has its own rules and is described in the following topics:
"String" on page 34
"Number" on page 35
"Boolean" on page 35
"Object" on page 36
"MovieClip" on page 36
"Null" on page 36
"Undefined" on page 36
When you debug scripts, you may 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
"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()
String
A string is a sequence of characters such as letters, numbers, and punctuation marks. You enter
strings in an ActionScript statement by enclosing them in single or double quotation marks.
Strings are treated as characters instead of as variables. For example, in the following statement,
is a string:
"L7"
favoriteBand = "L7";
You can use the addition (+) operator to concatenate, or join, two strings. ActionScript treats
spaces at the beginning or end of a string as a literal part of the string. The following expression
includes a space after the comma:
greeting = "Welcome," + firstName;
34
Chapter 2: ActionScript Basics
"Using variables in a program" on page
,
,
Number()
Object()
43.) There are also two special data
37).
,
.
String()
operator (see
typeof

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents