Welcome to my actionscript snippet library!

Actionscript Snips is a small repository of actionscript code that aims to save developers and designers time when developing a website.  

Center A Display Object


centerObject(obj); //Centers a display object

function centerObject(obj:DisplayObject):void {
obj.x = stage.stageWidth / 2 - obj.width / 2;
obj.y = stage.stageHeight / 2 - obj.height / 2;
}

0 comments:

Post a Comment