views:

49

answers:

1

recently, I research for the collection framework, and find LinkedSet(AS3Commons collection framework,it is a good opensource framework) written in ActionScript, but it can't use as dataProvider in ComboBox or DataGrid, because only implements ICollectionView can use as dataProvider. So I want to try if a class implements ICollectionView can work or not. I know Flex has build-in class implements ICollectionView, but I only want to define a class not use build-in class. The class as simple as possible.(can work is enough)

A: 

Call toArray on your LinkedSet and wrap it with mx.collections.ArrayCollection which implements ICollectionView, then hand that off to the ComboBox.

This works for any component that doesn't need to alter the underlying data structure. If you need to directly alter your Set via the controls, and copying to and from an Array isn't sufficent, you'll need to write your own implementation for ICollectionView and IViewCursor that wrap AS3CC's ICollection or whatever other class as you desire.

Gunslinger47
The LinkedSet doesn't have toArray() function, so I think the only way is to implements ICollectionView, but I'm not sure if it can show in ComboBox, so do you have a idea about implementation for ICollectionView, which can work in ComboBox, as I had said, as simple as possible
jason
@jason: LinkedSet does have a `toArray` method. [AbstractLinkedCollection.html#toArray](http://www.sibirjak.com/projects/as3commons/apidoc/org/as3commons/collections/framework/core/AbstractLinkedCollection.html#toArray%28%29)
Gunslinger47
thanks for your help
jason
@jason: Welcome to Stack Overflow. Remember to "Accept" your the answers to your question once you find them. This lets others know your question has been resolved, and rewards the people who helped you.
Gunslinger47
thanks for reminding me to "Accept" my answer. By the way, I need your help again. As I use toArray() to convert LinkedSet and wrap it with ArrayCollection, but when I add one item in LinkedSet, I think my solution is not good. I will put the question in another one, hope you can help, thanks
jason