hi everybody,
i would like to know if the following, for example,
MovieClip.prototype.beRed = function() {
new Color(this).setRGB(0xff0000);
};
is the right way to add methods to a class in Actionscript 2?
thanks
hi everybody,
i would like to know if the following, for example,
MovieClip.prototype.beRed = function() {
new Color(this).setRGB(0xff0000);
};
is the right way to add methods to a class in Actionscript 2?
thanks
technically, no. Pre-existing core classes technically shouldnt be altered like in the above example using AS 2. You would instead create your own class that inherits from MovieClip and define methods within that class in an external AS 2 class file. Then the method can be used on all instances of that class (set class association from the library or when you create your symbol).
Read more about it in the AS 2 OOP tutorial on kirupa.com
:: Copyright KIRUPA 2024 //--