Populate class that extends array?


Ok, I want a class that extends an array, and populates itself with named key values. Like this:

var array:CustomArray = new CustomArray();
trace(array[‘a’]); // Outputs ‘Hello World!’

But, writing this[‘a’] = ‘Hello World!’ inside the CustomArray class does not work, obviously.

I’m sure I can think of a workaround, but let’s just say I want it like this, how do I do it? How do I create the ‘a’ key inside the CustomArray class and assign a value to it?

/ Frank