开发者

How to declare a function to be equal to another function in as3?

If I wanted to create a function called printMe, what's the proper syntax so that it开发者_高级运维 prints what the function information prints?

var named:String="me";
var age:int=100;



function information():void{
    trace(named, age);
}

information();

I tried a few things like

printMe=information;
printMe();

Here are the errors I'm getting

Scene 1, Layer 'Layer 1', Frame 1, Line 8 1120: Access of undefined property printMe.

Scene 1, Layer 'Layer 1', Frame 1, Line 9 1180: Call to a possibly undefined method printMe.


Try

var printMe:Function = information;
printMe();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜