是否可以使用字符串值作为函数名称在 AS3 中调用函数,例如
var functionName:String = "getDetails";
var instance1:MyObject = new MyObject();
instance1.functionName(); // I know this is so wrong, but it gets the point accross:)
更新
@Taskinoor 关于访问函数的回答是正确的:
instance1[functionName]();
要访问我们将使用的属性:
instance1[propertyName]
最佳答案
实例1[函数名]();
查询 this一些细节。
关于apache-flex - Flex/AS3 - 使用字符串动态调用函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4489291/