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!
// actionscript in frame 1:
var button:Btn = new Btn(showUpgrade, 25, 5, "Show", true, 5);
addChild(button);
trace(button.x.toString()); // prints 0
// 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
}
}
}