Flash Actionscript委托函数出现故障。。。(myFunction).toString()打印函数(){}
我有一个Flash Actionscript委托函数出现故障。。。(myFunction).toString()打印函数(){},flash,actionscript-3,delegates,anonymous-function,Flash,Actionscript 3,Delegates,Anonymous Function,我有一个ViewToActionMap对象的向量,它有以下构造函数: public function ViewToActionMap(_forModule:eModule, _forAction:eViewAction, _toFunction:Function, _withArgs:Array=null
ViewToActionMap
对象的向量,它有以下构造函数:
public function ViewToActionMap(_forModule:eModule,
_forAction:eViewAction,
_toFunction:Function,
_withArgs:Array=null):void{
forModule = _forModule;
forAction = _forAction;
toFunction = _toFunction;
withArgs = _withArgs;
}
(eModule
/eViewAction
/带args
与我的帖子无关)
所以我的向量看起来像这样(为了简单起见,我只包含了它的第一个对象..):
///////////////这就是问题所在//////////////
如果我遍历actionMappings[0]的属性,则输出如下:
gpContinueButton
welcome
function Function() {} //<---------- why isn't this working?
null
gpContinueButton
欢迎
function(){}/解决了它:
似乎跟踪“.toFunction”
的值只会得到以下结果:function(){}
一旦我修复了一个不相关的bug,我就能够成功地调用startGame()。startGame是否包含任何逻辑行?如果您仅出于示例目的而省略它们,我深表歉意。不,还没有:函数startGame():void{trace(“call me!”)}代码>;)哈哈,我没有把它贴对(“;”结尾)。。。我认为这会导致编译器错误P
function startGame():void{ }
gpContinueButton
welcome
function Function() {} //<---------- why isn't this working?
null