Trying to reference dynamically created children on the stage
I'm using HTML5 and I need to dynamically create some objects from code, then modify them later by name. Right now I have:
var a1 = new lib.symbol3();
a1.name = "A1";
stage.addChild(a1);
var a2 = new lib.symbol3();
a2.name = "A2";
stage.addChild(a2);and so on.
But when I try to reference them by name, I get errors saying they are undefined. Even when I console.log them
console.log(stage["A1"]);
console.log(stage["A2"]);I get undefined.
Am I doing something wrong?