Store objects in an array?


Does anybody know if there is possible to store an object in an array? I have this class that I call Person and when I create an instance of that class, like:

[color=navy]var p:Person = new Person(“Josef”);[/color]

I would like to store it in an array. Is that possible? And if the answer is yes, how?

// phreaky

Yes it is possible , try this

var db:Array = []
var person = new Person(“Josef”);


Well, I’ve tried that and it does work. But! What dosn’t seem to work is the question of how I can retrive that stored objekt later on.

wouldn’t you just use db[index of object (ie 0)].property of object

Yes jerez_z is Correct !! Thank you jerez

index of Object is a number, have a posible value 0 to db.length

…I’m sorry but that doesn’t seem to work. Let’s say that the class Person har a method called getAge();

Normaly I would do something like this to retrive its stored data:
var numAge:Number = db[index].getAge();

But in this case it does not work.

Is it a public mathod which return Number ?? … Can you share the file???

well, I can publish my fla for you to se, but I need some time…

…it works now!

It was like you said, don’t know what i did…