About Top-Level And Built-In Classes - MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

4.
Select File > New and then select Flash Document to create a new FLA file, and save the
FLA file in the same directory as User.as.
5.
Type the following ActionScript code in Frame 1 of the Timeline:
trace(User.instances); // 0
var user1:User = new User();
trace(User.instances); // 1
var user2:User = new User();
trace(User.instances); // 2
The first line of code calls the static
of the private static
the User class and displays the current value returned by the
6.
Select Control > Test Movie to test the documents.
For information on using the
classes" on page
262.

About top-level and built-in classes

In addition to the ActionScript core language elements and constructs (
for example) and primitive data types (numbers, strings, and Booleans) described earlier in
this manual (see
Chapter 4, "Data and Data Types," on page 71
Language Fundamentals," on page
(complex data types). These classes provide a variety of scripting features and functionality. You
have used top-level classes and other built-in classes that are part of the ActionScript language
in earlier chapters, and you will use them throughout the remaining chapters. There are many
classes that ship with Flash that you use to create interactivity and functionality in your SWF
files, and you can even build complex applications using them. For example, you can use the
Math class to perform equations in your applications. Or you might use the BitmapData class
to create pixels and scripted animations.
Top-level classes, listed in
Actions toolbox, these classes are located in the ActionScript 2.0 Classes directory. Some of
the top-level classes are based on the ECMAScript (ECMA-262) edition 3 language
specification and are called core ActionScript classes. Examples of core classes are the Array,
Boolean, Date, and Math classes. For more information on packages, see
packages" on page
230.
286
Classes
instances()
variable. The rest of the code creates new instances of
numInstances
keyword in classes, see
this
113), ActionScript also provides several built-in classes
"Top-level classes" on page
getter method, which returns the value
instances()
"About using the this keyword in
for
and
Chapter 5, "Syntax and
288, are written into Flash Player. In the
"Working with
getter method.
and
loops,
while

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents