public const CONSTANT:int = 34;
var a:A = new A();
The CONSTANT property of object a can be referred using the following two formats:
Since CONSTANT is declared using const, it cannot be assigned a new value later on. So the following code doesn’t compile (as expected):
a.CONSTANT = 23;
However, the following code compiles and only throws an exception at run-time:
a["CONSTANT"] = 23;
Beware of this behavior of ActionScript when using consts in your code!
This has confused me some times in the past, so I thought I’d put it here for easy reference.
final int VALUE = 10;
const VALUE = 10;
const VALUE:Number = 10;
The point of confusion is that const is a reserved word in Java but is not used for declaring constants (yet!). Java uses the final keyword for this purpose.
You can easily enable ActionScript highlighting in gedit on Ubuntu with the following commands:
sudo wget http://conic.se/static/blog/code/Langfiles/actionscript.lang
sudo update-mime-database /usr/share/mime
I was facing problem running AIR projects since morning. Reinstalled Flex builder 3.0.2 a couple of times. I thought it was an issue related to upgrading to Flash Player 10. However, I later found (through google) that to make the older AIR projects run with the new release of Flex builder, you need to change the line
In app.xml to