ActionScript 3 has a keyword static that turns methods, fields, getter and setter into class members (not instance members).

It is a useful feature in languages as Java, where you have no top level functions and variables (btw. in JavaFX static is deprecated).

AS3 has both – static members and top level functions/variables (as JavaFX), so it is kind of an overkill in my opinion.

If you want to have a structural aggregation you can put all top level functions/variables in a special package.

For example there is a convention in CoreLibrary for constant carriers (have a look at the “StageAlign” class in “flash.display” package).

These carriers represent the possible input values for a property of a class. In the case of “StageAlign” it is the property “align” of the class “Stage”. (btw. FDT has a special auto completion for this conventional constant carriers)

It is possible to place all these constants in a package “flash.display.Stage” so you don’t have to write :

“StageAlign.LEFT” but just “ALIGN_LEFT” for example.

Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Before you submit form:
Human test by Not Captcha

© 2011 Max Blog Suffusion theme by Sayontan Sinha