View Full Version : x=0,y=0 chanfing the defult placement of this point
devil
05-03-2004, 07:10 AM
as a dafault flash makes x=0,y=0 point at the upper left corner...how can I change this? :confused:
I want this to be centered. I mean, want this point x=0,y=0 in the middle of the stage
any help, appreciated... ;)
CyanBlue
05-03-2004, 08:37 AM
Howdy and Welcome... :)
That pretty much is fixed and you cannot change it... What you can do is to move the _x and _y after you do something, like loading image and such...
petefs
05-03-2004, 08:57 AM
this will take care of essentially making the center of your stage 0,0.
centerX = function(name, oldval, newval){
var cx = newval + Stage.width/2;
return cx;
}
centerY = function(name, oldval, newval){
var cy = newval + Stage.height/2;
return cy;
}
this.watch("x", centerX);
this.watch("y", centerY);
x=0;
trace(x);
y=0;
trace(y);
drawbacks:
1. this only accounts for objects being positioned in the root scope (but all other movieclips can be moved so that 0,0 is in their center, so that's not a problem)
2. you'll have to make sure you assign the property AFTER assigning a value to x and/or y. i.e.
x = 10;
y= 30;
myMC._x = x;
myMC._y = y;
[edit:]
this could be made more efficient but at the cost of ease of understanding ^_^ it should do the trick for you, however.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.