You can take a look at the variety of variable types supported by the ActionScript Virtual Machine. Variable types are annotated by traits, the variety of which can be found in the specification, table 4.8.1:
4.8.1 Summary of trait types
The following table summarizes the trait types.
Type Value
Trait_Slot 0
Trait_Method 1
Trait_Getter 2
Trait_Setter 3
Trait_Class 4
Trait_Function 5
Trait_Const 6
There is no Trait_Enum
and note that under Trait_Const
description, only constants from the constant pool are allowed, so that would be:
- signed integers
- unsigned integers
- doubles
- strings
- type names and vector types
Enums could be made of signed or unsigned integers, for example, but the virtual machine would not perform any type-safety checking of the operations which used those types. (E.g., the getlocal
or coerce
opcodes used would be getlocal_i
and coerce_i
, respectively.)
The ABC format doesn't have any built-in provision for enum types that I know of.
Using an object type for each enum value could work, especially if the compiler emits coerce
instructions for that type prior to uses of getlocal
and otherwise doesn't use the object other than in istype
and astype
variants. For example, calling setproperty
or getproperty
on the object would be slower than using an integer -- especially if that property is bound to a getter or setter method.
There are replacement styles which have been linked in other answers. To evaluate the runtime performance impact of these styles, you can uses swfdump -D
from the swftoools open-source Flash tools collection.