Slowing down a for loop

Hey,

I just came accross an age old problem for me and id like to know some suggestions on how to tackle it.

It comes when dealing with loops and visual UI buttons.

var random:Array = new Array();
random.push(“hi1”);
random.push(“hi2”);
random.push(“hi3”);

for (var i:int = 0; i < random.length; i++)
{
var button:myCustomButton = new myCustomButton();
var x = 40;
var y = 30+(i*30);
addChild(button);
}

There is a few questions…

This dont look good, basically you know what happens, if my custom buttons have a tween then all 3 buttons tween at the same time. Id like to go for a delay of even have a second to cause a cascade type thing.

In order to get around this, i used to make an if loop seperared by 10 frames or so, however flex dont really let me do this so easily.

Instead of the for loop happening all in 1 frame, is it possible to set a delay, is there another loop i could use instead?

Thanks :smiley: