/ Published in: ActionScript 3
                    
                                        
Aligns any display object to the center od the stage
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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;
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                