Centering items to one another


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.