Hi, im trying to get a deeper understanding on how as works, I was wondering:
for(var i:int = 0; i < 100; i++)
{
[INDENT]var s:Sprite = new Sprite();
s.name = “sprite”+i;
addChild(s);
[/INDENT]}
var s is a reference to the the new Sprite
new Sprite is stored inside memory at some place
var s is also stored inside memory but only takes a small amount of space because it only needs to point to new Sprite?
the second time the loop runs, will the old var s be overwritten in memory? or will it be asigned to a new position in memory?
would it be beneficial if i typed something like this?
for(var i:int = 0; i < 100; i++)
{
[INDENT]var s:Sprite = new Sprite();
s.name = “sprite”+i;
addChild(s);
[COLOR=YellowGreen]s = null[/COLOR]
[/INDENT] }