You must always import your classes in external AS files.

In Flash, the flash.* sub packages are automatically imported.

This is working as intended.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Fumio Nonaka
Sent: Thursday, July 13, 2006 1:50 PM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] import statement and accessing a class in AS3

In ActionScript 3.0, a class can be accessed just by the name of the
class without the import statement in a timeline.

// timeline: _level0
// frame action (ActionScript 3.0)
// import flash.display.MovieClip;
trace(MovieClip);  // output: [class MovieClip]

On the other hand, a class cannot be accessed by its fully qualified
class name in a class definition.

// ActionScript 3.0 class definition file: Test.as
package {
        // import flash.display.MovieClip
        public class Test {
                function Test() {
                        trace(flash.display.MovieClip);  // ReferenceError
                }
        }
}

Are the behaviors above the specification of ActionScript 3.0?

Thank you




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to