Classes: (not so) Private Variables?

ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000]class[/COLOR] Vector2d [COLOR=#0000FF]extends[/COLOR] [COLOR=#0000FF]Math[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]private[/COLOR] [COLOR=#000000]var[/COLOR] x:[COLOR=#0000FF]Number[/COLOR];
[COLOR=#0000FF]public[/COLOR] [COLOR=#000000]var[/COLOR] y:[COLOR=#0000FF]Number[/COLOR];
[COLOR=#000000]var[/COLOR] ux:[COLOR=#0000FF]Number[/COLOR];
[COLOR=#000000]var[/COLOR] uy:[COLOR=#0000FF]Number[/COLOR];
[COLOR=#000000]var[/COLOR] mag:[COLOR=#0000FF]Number[/COLOR];
[COLOR=#000000]function[/COLOR] Vector2d[COLOR=#000000]([/COLOR]n1:[COLOR=#0000FF]Number[/COLOR], n2:[COLOR=#0000FF]Number[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
x = n1
y = n2
getMagCOLOR=#000000[/COLOR];
getUnitCOLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]function[/COLOR] getMagCOLOR=#000000[/COLOR]:[COLOR=#0000FF]Number[/COLOR][COLOR=#000000]{[/COLOR]
mag = [COLOR=#0000FF]sqrt[/COLOR]COLOR=#000000[/COLOR]
[COLOR=#0000FF]return[/COLOR] mag
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]function[/COLOR] getUnitCOLOR=#000000[/COLOR]:[COLOR=#0000FF]Void[/COLOR]
[COLOR=#000000]{[/COLOR]
ux = x/mag
uy = y/mag
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[/LEFT]
[/FONT]

ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#0000FF]import[/COLOR] Vector2d

n = [COLOR=#000000]new[/COLOR] Vector2d[COLOR=#000000]([/COLOR][COLOR=#000080]150[/COLOR], [COLOR=#000080]100[/COLOR][COLOR=#000000])[/COLOR]
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR]
n.[COLOR=#000080]x[/COLOR]+=[COLOR=#000080]150[/COLOR]
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR]
[/LEFT]
[/FONT]

I can’t seem to get my private variable, x, to be private. From my understanding of private variables, tracing n.x should throw an error, and adding 150 should throw an error. I’ve tried changing the variable’s name, and the cast type, to no avail. The first trace goes through, the addition goes through, and the second trace goes through.

I’m new to classes, so I could easily be overlooking something vital. But the vars need to be private, because I want to use get/set to update the variables when one or another changes. For instance, if 50 is added to the y value, the magnitude and unit vectors would change, so I want to update them using getMag and getUnit. That whole system would be thrown off if the user had direct access to the properties. If for some reason this whole idea is impossible, let me know.