MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 108

Actionscript language reference
Table of Contents

Advertisement

Example
The first line of the following code creates an empty object using the object initializer ({})
operator; the second line creates a new object using a constructor function:
var object:Object = {};
var object:Object = new Object();
The following example creates an object
,
,
city
state
zip
var account:Object = {name:"Macromedia, Inc.",
address:"600 Townsend Street",
city:"San Francisco",
state:"California",
zip:"94103",
balance:"1000"};
for (i in account) {
trace("account."+i+" = "+account[i]);
}
The following example shows how array and object initializers can be nested within each other:
var person:Object = {name:"Gina Vechio",
children:["Ruby", "Chickie", "Puppa"]};
The following example uses the information in the previous example and produces the same
result using constructor functions:
var person:Object = new Object();
person.name = "Gina Vechio";
person.children = new Array();
person.children[0] = "Ruby";
person.children[1] = "Chickie";
person.children[2] = "Puppa";
The previous ActionScript example can also be written in the following format:
var person:Object = new Object();
person.name = "Gina Vechio";
person.children = new Array("Ruby", "Chickie", "Puppa");
See also
[] (array access)
| (bitwise OR)
Availability
Flash Player 5.
Usage
expression1 | expression2
Parameters
expression1,expression2
108
Chapter 5: ActionScript Core Language Elements
, and
with accompanying values:
balance
,
,
Object class
new
A number.
and initializes the properties
account
,
,
name
address

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents