Inside your loop, you can add the sprite to a movieclip and give each movieclip 
a name using the variable in your loop like:

mcName.name = "mc"+i; //or whatever your for loop var is

And then remove it by getChildByName(mc#);


------Original Message------
From: Lehr, Theodore
Sender: flashcoders-boun...@chattyfig.figleaf.com
To: Flash Coders List
ReplyTo: Flash Coders List
Subject: RE: [Flashcoders] Finding and Removing a Sprite: PART II
Sent: Feb 23, 2010 10:55 AM

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


Nathan Mynarcik
Interactive Web Developer
nat...@mynarcik.com
254.749.2525
www.mynarcik.com

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

Reply via email to