开发者

Is it possible to use "get" and "set" on anonymous functions in AS3?

I've tried it, but perhaps the syntax is wrong:

course.totalScore = function get():int
{
...
}

I get "1084: Syntax error: expecting leftparen before get."

My impression is that this keyword is meant for use in classes only, i.e. it doesn't apply to AS3's underlying prototypal nature.

NOTE The example given is within a 开发者_如何学Pythonclass method, NOT in a timeline frame script, so don't quote me livedocs please.


The get and set functions only work on a class because they are meant to supplement the properties of a class. The don't make much sense outside of that context.


Yes, unfortunately, get, set and properties will only work in classes...


try

course.totalScore = function ():int
{
...
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜