Bindable Map

Recently I was going through some old drafts I had pending when I happened to notice I had never published this one, so I am finally doing so now…

Since first publishing an AS3 HashMap implementation back in December of 2006, much to my surprise the original post through which I released the API still yields a good amount of feedback each month.

In the time since I have extended the functionality of the HashMap to include a LocalPersistenceMap and ResourceMap in addition to the original HashMap; all of which implement the IMap interface and can be used interchangeably by client code.

The single most requested feature I have received has by far been to provide a Bindable HashMap implementation, and, just recently, I decided to implement one and share it with the community.

The implementation of the BindableMap is quite straightforward as it simply provides an API which wraps an IMap implementation in order to facilitate data binding capabilities to all read methods of the underlying Map.

Using the various IMap implementations with BindableMap yields some interesting possibilities; specifically when using BindableMap with LocalPersistenceMap as it essentially provides a bindable implementation of a LocalSharedObject, as can be seen in the following example (e.g. add some values and refresh the page):

[kml_flashembed publishmethod=”static” fversion=”10.0.0″ movie=”https://www.ericfeminella.com/blog/articles/assets/flex/BindableHashMapExample/BindableHashMapExample.swf” width=”400″ height=”400″ targetclass=”flashmovie”]

Get Adobe Flash player

[/kml_flashembed]

You can download the source, binary and example here.

{Sorry, Comments are currently Closed! }