static public const CONST_1 :String = "CONST_1";
static public const CONST_A :String = "CONST_A";
public var constantsArr :Array;
Is it possible to get an array of the class constant values without adding them manually like this:
constantsArr = [ CONST_1, CONST_A ];
Using describeType it should be possible :
public class Constants
{
static public const CONST_1 :String = "CONST_1";
static public const CONST_A :String = "CONST_A";
}
var xmlList:XMLList = describeType(Constants).child("constant");
var constantsArray:Array = [];
for each(var key:XML in xmlList)
{
constantsArray.push(key.attribute("name"));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With