On 4/12/06, Julian 'Julik' Tarkhanov <[EMAIL PROTECTED]> wrote:
> Funny though that imports do not do anything unless you use the
> classes directly. I'd say this is broken.

I disagree.

All 'import' does is to tell the parser which particular class you are
referring to.

If we assume that the file com/fred/MyMonkey.as exists, for example:

var monkey:MyMonkey=new MyMonkey();   // fails without an import statement

whereas:

import com.fred.MyMonkey;
var monkey:MyMonkey=new MyMonkey();

works, but could equally be written as:

var monkey:com.fred.MyMonkey=new com.fred.MyMonkey();

Import doesn't actually use the class per se - a solid reference of
some sort (such as the declaration of a variable or the creation of an
object) of that class suddenly means that it's actually been used, and
so the compiler notes that it needs to be compiled and included in the
output .swf.

The same, as far as I can recall (it's been a while now), is true of Java.

Otherwise typing something like:
import com.fred.*;
var monkey:com.fred.MyMonkey=new com.fred.MyMonkey();

Would compile in all of the code in your com.fred library - which it
patently doesn't do, and nor would I expect it to.

Cheers,
  Ian
_______________________________________________
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