AS3: Adding get/set methods to a class via prototype
- by LiraNuna
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'.