Max Blog

My Blog

The uselessness of static

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.

posted by admin in AS3 Creative point of view and have No Comments

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment
Before you submit form:
Human test by Not Captcha