# Populate class that extends array?

**URL:** https://forum.kirupa.com/t/populate-class-that-extends-array/246308
**Category:** Uncategorized
**Created:** [December 9, 2007, 11:43pm UTC](https://forum.kirupa.com/t/populate-class-that-extends-array/246308 "2007-12-09T23:43:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![frankonline](https://avatars.discourse-cdn.com/v4/letter/f/958977/32.png) [@frankonline](https://forum.kirupa.com/u/frankonline)
#### Post date: [December 9, 2007, 11:43pm UTC](https://forum.kirupa.com/t/populate-class-that-extends-array/246308/1 "2007-12-09T23:43:51Z")

</div>

Hi!

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
