Posted By

Empreintes on 10/11/10


Tagged

basic


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

bobbym245


Center a left-top corner based element in stage


 / Published in: ActionScript 3
 

just a basic center function

  1. var el:MovieClip = new MovieClip;
  2.  
  3. el.addEventListener(Event.ADDED_TO_STAGE,center);
  4.  
  5. private function center(evt:Event):void{
  6. evt.target.x = (stage.stageWidth - evt.target.width)/2;
  7. evt.target.y = (stage.stageHeight - evt.target.height)/2;
  8. }

Report this snippet  

You need to login to post a comment.