Posted By

sidneydekoning on 05/14/09


Tagged

position


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

sidneydekoning
letmein_xxi


Centering items to one another


 / Published in: ActionScript 3
 

  1. // This can only be done then the registration point is top left and objects don't have graphics in its negative space
  2.  
  3. // horizontal alignment
  4. b.y = a.y + (a.height - b.height) * 0.5;
  5.  
  6. // vertical alignment
  7. b.x = a.x + (a.width - b.width) * 0.5;

Report this snippet  

You need to login to post a comment.