views:

47

answers:

1

I have a sprite in which I have added other sprites. Something like:

var sp_main:Sprite = new Sprite();
var sp_group:Sprite = new Sprite();

for(i:int = 0; i < 10; i++)
{
   var temp:Sprite = new Sprite();

   sp_group.addChild(temp);
}

sp_main.addChild(sp_group);

//this part doesn't seem to work... i don't mind doing it another way, but 
//am unaware of one.
sp_main["sp_group"].alpha = 0.0;

Any thoughts on how I might accomplish this or something similar?

+3  A: 
sp_main.getChildAt(0).alpha = 0;

(assumes sp_main contains only sp_group).

or

sp_main.getChildAt(sp_main.getChildIndex(sp_group)).alpha = 0;

or (if you've named sp_group)

sp_group.name = "sp_group";
sp_main.getChildByName("sp_group").alpha = 0;
Tegeril
Great; thank you. I was using more of an AS2 syntax. :p
jml