Posted By

gurpreet on 07/27/09


Tagged

align as3 Aligntocenter


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

abbey
DualBrain
davidino1978


Align to Center


 / Published in: ActionScript 3
 

Aligns any display object to the center od the stage

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

Report this snippet  

You need to login to post a comment.