as 使用类模拟枚举类
//这种类一般不需要继承(final), 成员也应该是静态常量(static const)
//---------------------------------
package {
public final class CTest {
public static const MALE:String = "male";
public static const FEMALE:String = "female";
}
}
//---------------------------------
var age:String;
age = "female";
//age = "male";
switch (age) {
case CTest.MALE:
trace("Male");
break;
case CTest.FEMALE:
trace("Female");
break;
default:
trace("?");
}