Position stuff relative to the Stage

Feel free to use these to help in positioning stuff relative to the Stage. Acts on the registration point of the object.

e.g. if you have a movieclip 200 pixels wide with a lefttop registration point, you have to subtract 200 from rightEdge so it aligns nicely.

// Size of your flash canvas
var canvasWidth = 550;
var canvasHeight = 400;

var leftEdge = (canvasWidth/2)-(Stage.width/2);
var rightEdge = (canvasWidth/2)+(Stage.width/2);
var topEdge = (canvasHeight-Stage.height)/2;
var bottomEdge = Stage.height - ((Stage.height-canvasHeight)/2);
var centerScreen = (canvasWidth/2) - (menuWidth/2);

Hope this is useful especially for those who have been trying to achieve menus that stays on one side whenever the browser is resized.