Skip to main content
Participant
July 19, 2009
Question

import instruction purpose

  • July 19, 2009
  • 1 reply
  • 466 views

AS1, AS2 don't require import instruction

AS3 require. Why?

P.S. sorry for my english

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
July 19, 2009

The import statement is not something new in AS3.  AS2 also uses it for the same purpose as AS3, to import class files.  If you need to know more about it, refer to the Flash help documentation for detailed information.

Participant
July 19, 2009

I read all about import in official Help. But i don't understand why need import if i use complete path to class

for example:

new package1.package2.Class1();

Ned Murphy
Legend
July 19, 2009

The help documents, again, will explain the differences.  "If you want to use a class that is inside a package, you must import either the package or the specific class. This differs from ActionScript 2.0, where importing classes was optional."

If you are looking for the genuine reason why anything is different between AS2 and AS3, you aren't likely to find that out.  I figure there's this small group  of programmers that were bottle-fed OO as infants and have their own opinions on how to deal with rewriting a language and among themselves decided what knit-picky things they would and would not allow.