Actionscript 3 as3函数指针
这行不通,但你能看到我在做什么吗?这有点像函数指针,或者当您将函数名传递给事件侦听器时。谢谢 您需要的是:Actionscript 3 as3函数指针,actionscript-3,function,pointers,Actionscript 3,Function,Pointers,这行不通,但你能看到我在做什么吗?这有点像函数指针,或者当您将函数名传递给事件侦听器时。谢谢 您需要的是: private function myFunction(numIn:Number){ trace ("numIn " + numIn); } var plan:Object = { "theFunctionName": "myFunction" } // now use the function plan.theFunctionName(5); // should tra
private function myFunction(numIn:Number){
trace ("numIn " + numIn);
}
var plan:Object = { "theFunctionName": "myFunction" }
// now use the function
plan.theFunctionName(5);
// should trace out: "numIn 5"
要么照雅各布的建议去做,要么你就这么做:
var plan:Object = { theFunctionName: myFunction }
// Your function.
function myFunction(numIn:Number):void
{
trace("numIn " + numIn);
}
// Assign "myFunction" to the property "callback" of type "Function".
var callback:Function = myFunction;
// Call "myFunction" via "callback".
callback(5); // numIn 5