ok, bar isn't the name of the sprite, it's a variable with name bar which
contains a reference to your sprite... if you want to use names then do
something like bar.name = String("bar_" + i); but personally i'd use an
array like so...
var bars:Array = [];
function createBars():void
{
for (var i:int=0; i<totalbars; i++)
{
var bar:Sprite = new Sprite();
...............
addChild(bar);
bars.push(bar);
{
}
then you can get at the bars later to do stuff with them or remove them...
On 23 February 2010 17:55, Lehr, Theodore <[email protected]> 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
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders