开发者

controlling the properties of a sprite's child sprites

开发者 https://www.devze.com 2022-12-14 21:10 出处:网络
I have a sprite in which I have added other sprites. Something like: var sp_main:Sprite = new Sprite();

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"].a开发者_如何学Pythonlpha = 0.0;

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


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消