# MovieClip subClass: getters, setters and mouseEvents

**URL:** <https://forum.kirupa.com/t/movieclip-subclass-getters-setters-and-mouseevents/193959>\
**Category:** flash\
**Created:** [July 19, 2006, 4:20pm UTC](https://forum.kirupa.com/t/movieclip-subclass-getters-setters-and-mouseevents/193959 "2006-07-19T16:20:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwopitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jwopitz/32/1556_2.png) [@jwopitz](https://forum.kirupa.com/u/jwopitz)\
**Post date:** [July 19, 2006, 4:20pm UTC](https://forum.kirupa.com/t/movieclip-subclass-getters-setters-and-mouseevents/193959/1 "2006-07-19T16:20:26Z")

</div>

Hi folks. I am plain stumped. I am working in F8/as2.0.

I have a class that extends the MovieClip class. I have a blank\_mc in the library that is linked to the class. Here is the constructor:  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#0000ff]public[/COLOR] [COLOR=#000000] **function** [/COLOR] MyMC COLOR=#000000[/COLOR][COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] \_mc:[COLOR=#0000ff]MovieClip[/COLOR] = [COLOR=#0000ff]this[/COLOR];  
\_mc = target\_mc.[COLOR=#0000ff]attachMovie[/COLOR] COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

That works all fine and dandy. Where I am having issues is basically I have properties x, y that DON’t overwrite the \_mc’s \_x & \_y props. Instead, the use getter & setters that take values and then calculate the needed number to set the actuall \_mc.\_x, \_y props. This doesn’t seem to work at all and i don’t know why. Here is the code:  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#000000] **function** [/COLOR] set x COLOR=#000000[/COLOR]:[COLOR=#0000ff]Void[/COLOR] [COLOR=#000000]{[/COLOR]  
\_\_x = num;  
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]\_x[/COLOR] = [COLOR=#000000]([/COLOR][COLOR=#0000ff]do[/COLOR] some calculations based [COLOR=#0000ff]on[/COLOR] num[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

Of course this is really generalized. But is \_\_x a private property of the MovieClip class and I am interfering with it?

On to issue two…

So I got this to work by NOT extending the MC. Instead I have a variable ref to a \_mc prop in the class. However I am unable to set event functions to it even if I make some ref to the \_mc prop. Is there a good way of approaching this by say a decorator pattern?
