MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 248

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

Advertisement

{} (object initializer)
Availability
Flash Player 5.
Usage
object = {name1: value1, name2: value2,...nameN: valueN}
Parameters
The object to create.
object
name1,2,...N
value1,2,...N
Returns
None.
Description
Operator; creates a new object and initializes it with the specified
Using this operator is the same as using the
using the assignment operator. The prototype of the newly created object is generically named the
Object object.
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.
object = {};
object = new Object();
The following example creates an object
,
,
city
state
zip
account = { name: "Betty Skate",
address: "123 Main Street",
city: "Blossomville",
state: "California",
zip: "12345",
balance: "1000" };
The following example shows how array and object initializers can be nested within each other.
person = { 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.
person = new Object();
person.name = 'Gina Vechio';
person.children = new Array();
person.children[0] = 'Ruby';
person.children[1] = 'Chickie';
person.children[2] = 'Puppa';
248
Chapter 12: ActionScript Dictionary
The names of the properties.
The corresponding values for each
, and
with accompanying values.
balance
property.
name
syntax and populating the property pairs
new Object
and initializes the properties
account
and
property pairs.
name
value
,
name
address
,

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?

Questions and answers

Table of Contents