Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- placeObjects = function() {
- var sw:Number = Stage.width;
- var sh:Number = Stage.height;
- var msw:Number = Math.round(sw * .5);
- var msh:Number = Math.round(sh * .5);
- //place an object to the center of the stage
- yourObject._x = msw - (yourObject._width * .5);//... horizontally
- yourObject._y = msh - (yourObject._height * .5);//... and vertically
- };
- placeObjects();//invoke the function
- //add a stage-resize Event listener
- var tfmSl:Object = new Object();
- tfmSl.onResize = function() {
- placeObjects();
- };
- Stage.addListener(tfmSl);
Add Comment
Please, Sign In to add comment