Hello and thanks in advance if anyone can come up with a better way to handle this in AS3.
Basically I want to call a const by a int.
here is the code i have so far…
public static const _100:String = “name=lion legstype=legs";
public static const _101:String = "name=lion tailtype=tail”;
public static const _200:String = “name=tiger legs*type=legs”;
///more lines going down with the number on the far left being the main differentiating factor
public static function getByName(name:int):String {
switch(name) {
case 100 :
return _100;
break;
case 101 :
return _101;
break;
case 200:
return _200;
break;
…///i dont want to write a case for every const X[
default : return _0;
}
}
is there a better way out there to call the constants by an outside int without having a switch function handle the logic? Thanks again :] :samus_v2: