flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FlexJS] Stuck due to "Dictionary"
Date Thu, 09 Feb 2017 23:33:46 GMT
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" <joshtynjala@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 <carlosrovira@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
>>

Mime
View raw message