I had a need for Dictionary for my purposes as well (i.e. using Objects as keys).
I just implemented ObjectMap which wraps Map, WeakMap and Dictionary. It falls back to plain objects for browsers which do not support Map and inserts uids into the objects. It’s not tested yet, but it compiles. I expect to test it in the next few days. > On Feb 10, 2017, at 1:33 AM, Alex Harui <aha...@adobe.com> wrote: > > Also consider whether you truly need Dictionary or not. A Weak Reference > Dictionary of Classes, for example, is completely unnecessary if you have > a single ApplicationDomain application. The classes are never going to be > unloaded, so you don't need weak references to them. > > I was able to get Spark HelloWorld to run on FlexJS without using a > Dictionary because I took some shortcuts since HelloWorld is a single SWF > application. > > Also note that, in the browsers I tested, if you put an Object as a key > for an Object, the JS runtime seems to call toString() on it to get a key. > And also remember that Classes and Instances are all mutable in JS so you > can hang a UID on each instance/object to use as a key if you want. > > HTH, > -Alex > > PS: The next thing you should look for in the code is use of weak > reference listeners. I don't have a good answer for that. > > > On 2/9/17, 2:23 PM, "Josh Tynjala" <joshtynj...@gmail.com> wrote: > >> If you only need strings as keys, then Object is the right choice. >> >> JavaScript has Map and WeakMap for non-string keys, which is similar to >> Flash Player's Dictionary: >> >> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_O >> bjects/Map >> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_O >> bjects/WeakMap >> >> Be aware that Map and WeakMap are relatively new in JavaScript. For >> instance, it looks like IE11 has partial support (with full support in >> Edge), but older versions of IE can't use it. >> >> - Josh >> >> On Thu, Feb 9, 2017 at 2:13 PM, Carlos Rovira <carlosrov...@apache.org> >> wrote: >> >>> Hi, >>> >>> we have some flash Dictionary replacement? >>> If not what we could use instead? or what is the recommended approach? >>> >>> thanks! >>> >>> >>> >>> -- >>> Carlos Rovira >>> http://about.me/carlosrovira >>> >