AS3: Adding get/set methods to a class via prototype
Posted
by LiraNuna
on Stack Overflow
See other posts from Stack Overflow
or by LiraNuna
Published on 2010-04-12T19:32:50Z
Indexed on
2010/04/12
20:22 UTC
Read the original article
Hit count: 304
I'm looking for a way to extend a class via prototype by adding a get and set functions.
The following code will add a function to the class' prototype:
MyClass.prototype.newMethod = function(... args) {
};
However I want to add both a get
and set
functions. I tried:
MyClass.prototype.fakeProperty = get function(... args) {
};
MyClass.prototype.fakeProperty = set function(... args) {
};
But that seem to throw compile errors.
Is this even possible? Is there some 'internal' naming convention for get/set functions?
I am not looking for answers such as 'create a new class and new get/set functions there'.
© Stack Overflow or respective owner