# Class extending MovieClip has innacurate this.x/this.y values

**URL:** <https://forum.kirupa.com/t/class-extending-movieclip-has-innacurate-this-x-this-y-values/322463>\
**Category:** flash\
**Created:** [May 22, 2011, 6:45am UTC](https://forum.kirupa.com/t/class-extending-movieclip-has-innacurate-this-x-this-y-values/322463 "2011-05-22T06:45:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chalks](https://avatars.discourse-cdn.com/v4/letter/c/e274bd/32.png) [@Chalks](https://forum.kirupa.com/u/Chalks)\
**Post date:** [May 22, 2011, 6:45am UTC](https://forum.kirupa.com/t/class-extending-movieclip-has-innacurate-this-x-this-y-values/322463/1 "2011-05-22T06:45:48Z")

</div>

I would love if someone could take a look at the code below. When you do, you’ll see that the movieclip should obviously be at position (0, 0) on the stage. However it appears at (25, 5)! if I leave in the original “this.x = xx;”, then it appears at (50, 5). If I also leave in “this.y=yy;” then it appears at (50, 10).

Any ideas what’s happening? I feel like I’m doing something extremely dumb.

Thanks!

```auto
// actionscript in frame 1:
     var button:Btn = new Btn(showUpgrade, 25, 5, "Show", true, 5);
     addChild(button);
     trace(button.x.toString()); // prints 0

```

```auto
// Btn class
package {
     // imports here
public class Btn extends MovieClip {
             // global vars here
      public function Btn(cback:Function=null, xx:Number=0, yy:Number=0, lbl:String="Button", manualButton:Boolean=false, wdth:Number=0, hght:Number=0) {
         trace(this.x.toString()); // prints 0
         this.x = 0;
         trace(this.x.toString()); // prints 0
         this.y = 0;
         // other irrelevant code below
    }
}
}

```
