Return to Snippet

Revision: 16118
at July 27, 2009 09:56 by gurpreet


Initial Code
public static function alignToCenter(obj:DisplayObject):void
{
	obj.x = obj.stage.stageWidth / 2 - obj.width / 2;
	obj.y = obj.stage.stageHeight / 2 - obj.height / 2;
}

Initial URL

                                

Initial Description
Aligns any display object to the center od the stage

Initial Title
Align to Center

Initial Tags

                                

Initial Language
ActionScript 3