After having seen the properties (variables inside an Actionscript 3.0 class), we can now introduce the constants.
The constants are a new characteristic implemented in the version 3.0. In fact, with the 2.0 they were not present.
For convention, they are declared using a name in capital letters so to understand at first sight that we are dealing with constants and not variables (properties).
We can define the value of a constant but we cannot modify it.
If we use more words as the constant name, it is of good rule to add an underscore in between the words.
Examples:
- Event.COMPLETE, COMPLETE is a constant of the Event class.
- MouseEvent.CLICK, CLICK is a constant of the MouseEvent class.
Let us look at it with even more examples…







{ 0 comments… add one now }