How to define enum in as3?

Posted by Nava Carmon on Stack Overflow See other posts from Stack Overflow or by Nava Carmon
Published on 2010-03-06T21:23:00Z Indexed on 2010/05/11 7:44 UTC
Read the original article Hit count: 348

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about enumeration