Archive for the 'ArrayCollection' Category

14
May

Determining when an ArrayCollection changes in Flex

The following example shows how you can detect when a Flex ArrayCollection has changed (items added, removed, refreshed) by listening for the collectionChange event.

Full code after the jump.

Continue reading ‘Determining when an ArrayCollection changes in Flex’

10
May

Displaying specific items from an ArrayCollection in Flex

The following examples show how you can display specific items in a Flex ArrayCollection using the getItemAt() method and the array access operator ([]).

Full code after the jump.

Continue reading ‘Displaying specific items from an ArrayCollection in Flex’

15
Apr

Creating a view cursor on an ArrayCollection in Flex

The following example shows how you can create a view cursor to find a specific item within an ArrayCollection.

Full code after the jump.

Continue reading ‘Creating a view cursor on an ArrayCollection in Flex’

12
Mar

Using a CheckBox to filter items in a DataGrid in Flex

The following example shows how you can filter items in a Flex DataGrid using a CheckBox control, and the ArrayCollection class’s filterFunction property.

Full code after the jump.

Continue reading ‘Using a CheckBox to filter items in a DataGrid in Flex’

05
Aug

Removing duplicate items from an array using the Array.filter() method

I’m sure there is an easier/better way to do this (and I’ll update this post accordingly if I find one) but here is a little sample which takes an array of items and filters out the duplicates.

Full code after the jump.

Continue reading ‘Removing duplicate items from an array using the Array.filter() method’

05
Aug

Sorting an ArrayCollection using the SortField and Sort classes

Sometimes in life you just need data to be sorted. Whether its a case insensitive sort (for names) or a numeric sort (for, uh, numbers), you just want things sorted in a particular order.

This example demonstrates how you can take a bunch of random numbers in an ArrayCollection and sort them numerically in ascending order.

Full code after the jump.

Continue reading ‘Sorting an ArrayCollection using the SortField and Sort classes’