Guest User

Untitled

a guest
Jan 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. placeObjects = function() {
  2. var sw:Number = Stage.width;
  3. var sh:Number = Stage.height;
  4. var msw:Number = Math.round(sw * .5);
  5. var msh:Number = Math.round(sh * .5);
  6.  
  7. //place an object to the center of the stage
  8. yourObject._x = msw - (yourObject._width * .5);//... horizontally
  9. yourObject._y = msh - (yourObject._height * .5);//... and vertically
  10. };
  11. placeObjects();//invoke the function
  12.  
  13. //add a stage-resize Event listener
  14. var tfmSl:Object = new Object();
  15. tfmSl.onResize = function() {
  16. placeObjects();
  17. };
  18. Stage.addListener(tfmSl);
Add Comment
Please, Sign In to add comment