Skip navigation

Tag Archives: dataprovider

First, click here to view a quick demo of the problem. (Source here). When the lists load, roll over one of the items labeled “something” and notice the hover behavior.

The problem is, that these Lists are bound to and Array and an ArrayCollection of Strings (which are immutable in AS3). Likewise, if multiple entries in an Array referenced the same object, the same issue would occur.

This is a particularly annoying implementation challenge, where you might commonly want to bind an Array of String to a List. This may or may not actually be a bug–well it might be, in that the requirement for uniqueness in dataProviders isn’t very well documented–but it is consistent with how Arrays work in AS3. If you have two strings in an ArrayCollection, for example, the only way to retrieve a particular value is to do so by index; you cannot call .getItem(“stringvalue”) because the collection has no idea which one you are referring to.

The workaround is either to wrap each item in a new object, such that [{label: “string value”}, {label: “string value”}] so that each object actually exists as a unique object in memory, or to wrap ArrayCollection so that it recognizes primitives and wraps them automatically.

This “bug” is being tracked here: https://bugs.adobe.com/jira/browse/SDK-17182 reported by Albert Chang.

This effect was brought to my attention by Winton De Shong.

Advertisements