I think the issue is that you are waiting until you exit the loop to do any
addChild() calls. In that case you will only ever get one sprite added to
the display list. This is because when the loop is done it only has a single
reference to a sprite.

You might want to do two things. First, and most important, add each sprite
to an array. Second, call addChild() within the loop.


var mySpriteArray:Array = new Array();

for (var j:uint = 0; j < _columns; j++)
{
    var sprite:Sprite = new Sprite();
    // This will allow you to reference the sprites
    //  later more easily.
    mySpriteArray.push(sprite);
    addChild(mySpriteArray[j]); // or addChild(sprite);
}

Charles P.



On Dec 30, 2007 11:23 AM, Matt Muller <[EMAIL PROTECTED]> wrote:

> Hi, does anyone know how to create individual sprite instances in a loop
>
>                for (var j:uint = 0; j < _columns; j++)
>                {
>                    var sprite:Sprite = new Sprite();
>                }
>
> this just over writes the sprite.
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to