You could create an empty array (outside the functions)
And add each newly created bar to the array.
Afterwards, say in another function, you can reference the array
indexes.
Something like:
myBarsArray = new Array();
function createBars():void
{
for (var i:int=0; i<totalbars; i++)
{
var bar:Sprite = new Sprite();
...............
addChild(bar);
myBarsArray.push(bar);
{
}
function removeBars(i:uint):void
{
removeChild(myBarsArray[i]);
//don't remove the bar from the array
}
HTH,
Willem
On 23-feb-2010, at 17:55, 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
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)
30-2719512 or cell phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders