views:

556

answers:

1

So I want to extend the dictionary class. Everything works so far except that in some of my methods that need to reference the dictionary's content I make a call like:

this[ key ]

It doesn't like that. It just tells me that there's no property 'key'. Is there a way to way to access the data within this class?

Also, I'm using an integer for the key.

Edit: I've found that the same behavior happens when you extend Array.

var myArray : Array = new Array();
trace( myArray[ 0 ] );
var myArrayExtender : ArrayExtender = new ArrayExtender();
trace( myArrayExtender[ 0 ] );

Where in this case, myArray returns "undefined" and myArrayExtender throws error 1069. ArrayExtender is an empty class that extends Array and calls super() in the constructor.

A: 

from what you say, i am quite sure you did not declare ArrayExtender as dynamic in ECMAscript array access and property access are semantically equivalent ... #1069 happens, if you access an undefined property, on a sealed class, because thes do not allow adding properties at runtime ...

same thing for the Dictionary ...

back2dos
Interesting. Helpful again. Thank you sir or madam.
grey