for each (var o:* in list) { i++; if (i>x) { i=0; h = new HBox(); parent.addChild(h); } h.addChild(o); }