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
{
...
}
精彩评论