ActionScript 3 Language Specification |
|||
| ActionScript 3.0 Language Specification > 1 Tutorial introduction > 1.8 Packages | |||
Packages in ActionScript are very similar to packages in Java and namespaces in C# and C++. Packages are useful for organizing frameworks (or toolkits, or APIs) into sets of related definitions: classes, namespaces, interfaces, functions, and variables.
Client code can import all or parts of a package to access the functionality it provides without cluttering its global namespace with unneeded names. In the following example, the import directive makes the class Greeter visible to the global code that contains the import directive.
package actors {
public class Greeter {
public function hello() {
trace("hello, world")
}
}
}
import actors.Greeter
var greeter : Greeter = new Greeter
greeter.hello()
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/specs/actionscript/3/as3_specification10.html
Comments
Constantiner said on Mar 2, 2006 at 11:42 AM :