Posted By

StrawMan on 06/02/09


Tagged

rows columns as3


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

sidneydekoning
Pingpongbal
burnandbass
dubogii
thePandaman


Dynamic Columns & Rows


 / Published in: ActionScript 3
 

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

Care of David Pett. See link.

  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. }

Report this snippet  

You need to login to post a comment.