bar.name = "bar_" + i;


function destroyBars():void {
       for (var i:int=0; i<totalbars; i++)
       {
         var bar:Sprite = getChildByName("bar_" +i) as Sprite;
         if(bar) {
            ...
            removeChild(bar);
         }
        }
}

Lehr, Theodore wrote:
So here is my next issue... One of the functions creates a dynamic amount 
sprites based on an xml feed, like so


function createBars():void
{
     for (var i:int=0; i<totalbars; i++)
     {
           var bar:Sprite = new Sprite();

              ...............

           addChild(bar);

     {
}

And see this this is where my ears start to bleed... this is seemingly creating, say, 9 
Sprites ALL with the same name "bar".... I need to keep the new Sprite() line 
in the loop for them to be created... but then I need some way to access them to delete 
them....

Any ideas?
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to