So heres my code in my main game loop:
if (! initialized)
{
for (var c = 1; c < 1000; c++)
{
var particle:Particle = new Particle();
particle.name = "particle" + c;
trace(particle.name);
}
initialized = true;
}
particle4.x = 200;
particle4.y = 300;
addChild(particle4);
The error given is “1120: Access of undefined property particle4.” However, everything traces correctly, but the individual particles cannot be accessed outside of the loop. Eventually I want to add the next particle at the mouse position on every click, but obviously I can’t do that without being able to access the individual particles. I also read about having to use getChildByName() to access names set in AS3, but I haven’t been able to get that to work either. Help appreciated.