Dynamic Columns & Rows


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

Care of David Pett.
See link.


Copy this code and paste it in your HTML
  1. var numOfColumns:int = 5;
  2. var spacer:int = 10;
  3.  
  4. for(var i:int; i < 10; i++) {
  5. var item:ItemToAdd = new ItemToAdd();
  6. item.x = (i % numOfColumns) * (item.width + spacer);
  7. item.y = Math.floor(i / numOfColumns) * (item.height + spacer);
  8. addChild(item);
  9. }

URL: http://www.davidpett.com/actionscript-3-dynamic-rows-and-columns/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.