I have the following;
var myName:String="myMethod";
function myMethod() {
.....
}
is there a way to call this method by using myName
?
I have the following;
var myName:String="myMethod";
function myMethod() {
.....
}
is there a way to call this method by using myName
?
this[myName](); // should work
yourInstanceOfTheClass[myName](); // this should also work.
If it is a Static function in a class say Main.
Class Main{
static function myMethod(){}
static function run(){
Main["myMethod"](); // will also work for static methods.
}
}