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?