Code Slinger: A DP Blog

VectorCollection

Posted At: May 18, 2010 2:05 PM | Posted By: Michael Labriola
Related Categories: Adobe Flex

First, let me say I am sorry. A year or so ago, I wrote these VectorCollection classes. They are not spectacular works of art, they are very basic implementations required to use Vector inside of Flex components which are looking for IList and ICollectionView for their dataProviders. Vector has some performance advantages in some cases (for more details, take a look here. ) but overall, the big advantage to me is type safety. I know what should be in the Vector and flash knows if I mess that up. On the whole, these are simple implementations that don’t solve every problem I would love to solve if I had the Flash Player source and some time, but they will allow you to use Vectors more directly in Flex. So, if you find them useful, then enjoy. private var source:Vector.<uint>; source = new Vector.<uint>; private var vc:VectorListCollection; vc = new VectorListCollection( source ); var sort:Sort = new Sort(); var field:SortField = new SortField( null, false, false, true ); sort.fields = [field]; vc.sort = sort; vc.refresh(); File Available Here Cheers, Mike

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • PDF
  • RSS
  • email
  • Technorati

Comments (2)

2 Responses to “VectorCollection”

  1. Nice. Gonna try and use this in a project I am currently working on!

  2. Tom Schober says:

    This looks great for putting that square peg into the round hole that is the dataProvider, but how do we type the VectorListCollection, or do you think that’s even necessary?

    i.e.
    private var typedVc : VectorListCollection.<MyType>;

Leave a Reply