Get access to a stored Sprite in a array

i’m not getting how to do this, I create a sprite and then store it’s refence in a array, what I want is to use that refence to call it later… but really don’t know what’s wrong…

here’s the code:
[AS]// place a moviclip on stage with instance name of: “container”

var storeGraf:Array = new Array();

// draw something in a sprite
var target1:Sprite = new Sprite();
target1.graphics.beginFill(0xCCFF00);
target1.graphics.drawRect(0, 0, 100, 100);
target1.name = “target1”;

storeGraf[0] = target1 as Sprite;

container.addChild(target1);

//container.getChildByName(‘target1’).alpha = .5;

container.storeGraf[0].alpha = .5;[/AS]

thanks

You probably know this already, but using the line that is commented out would work.

You could also use:

storeGraf[0].alpha = .5;

storeGraf isn’t a property of container, which is why you were getting errors before.

hey krilnon! really thanks : )

I think I get it, if I store the sprite in the array it will be as simple as call it from the array no matter where the Sprite has been added in the display list?! I feel a bit of fog in my eyes…no?

this is different from the logic that i follow back in as2, if I would attach a movie clip inside another, store it’s name inside an array, then when calling this clip I would “build” up the path by the name of the container and then the name of the clip stored in the array… hummm migrations issues :stuck_out_tongue:

I’ve to clarify this questions… maybe some reading wouldn’t bad thought.

thanks

if I store the sprite in the array it will be as simple as call it from the array no matter where the Sprite has been added in the display list?!

Yep!

this should be in the front page of adobe!
the great things of as3 :smiley: heheh

ok! this will make life really easy, i’ll earn more money next month for sure :stuck_out_tongue:
i have lack of basic knowledge about coding. :\