How to define enum in as3?
actionscript-3, enumeration
Solution
No AS3 doesn't have enum, you have to code them yourself. You can simulate them for example by a class if you want safer type checking.
Problem
Is there a way to define an enum in AS3 in a way we do it in other languages? I can define constants with defined values like that: ``` private const CONST_1:int = 0; private const CONST_2:int = 1; private const CONST_3:int = 2; ``` and so on. If I want to insert some other constant between 3 these I need to move all values like that: ``` private const CONST_1:int = 0; private const CONST_2:int = 1; private const CONST_2A:int = 2; private const CONST_3:int = 3; ``` while in other language I would end up with only adding a new member to enum closure like that: ``` enum { CONST_1 = 0, CONST_2, CONST_2A, CONST_3 } MyConstEnum; ``` Does AS3 has something similar? Thanks