# Add methods to a class in AS 2

**URL:** <https://forum.kirupa.com/t/add-methods-to-a-class-in-as-2/64228>\
**Category:** Uncategorized\
**Created:** [September 14, 2004, 11:40am UTC](https://forum.kirupa.com/t/add-methods-to-a-class-in-as-2/64228 "2004-09-14T11:40:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gpleone](https://avatars.discourse-cdn.com/v4/letter/g/b4bc9f/32.png) [@gpleone](https://forum.kirupa.com/u/gpleone)\
**Post date:** [September 14, 2004, 11:40am UTC](https://forum.kirupa.com/t/add-methods-to-a-class-in-as-2/64228/1 "2004-09-14T11:40:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 14, 2004, 11:45am UTC](https://forum.kirupa.com/t/add-methods-to-a-class-in-as-2/64228/2 "2004-09-14T11:45:11Z")

</div>

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](http://kirupa.com)
