大家都知道,主场景中的某个影片剪辑mm0,可以通过this["mm"+0]去访问。
是不是可以通过字符串去调用函数呢?
答案是肯定的,
var myfunc:String = "functionFromVariable";
function functionFromVariable() : void
{
trace("I was ran from a string");
}
this[myfunc](); 输出://I was ran from a string
大家都知道,主场景中的某个影片剪辑mm0,可以通过this["mm"+0]去访问。
是不是可以通过字符串去调用函数呢?
答案是肯定的,
var myfunc:String = "functionFromVariable";
function functionFromVariable() : void
{
trace("I was ran from a string");
}
this[myfunc](); 输出://I was ran from a string