Feathers 3.2

Congratulations to Josh Tynjala and the Feathers open source project for the release of Feathers 3.2. Feathers offers a large collection of ActionScript user interface components and layouts for mobile and desktop. It is powered by both Starling Framework and Adobe AIR.

What’s new in this release?

In version 3.2.0, Feathers UI includes a new PullToRefresh example, a new swipe gesture for TabNavigator, real time collection filtering, and support for asynchronous texture uploads with the ImageLoader component.

Collection filtering

The new filterFunction property in the ListCollection class makes it possible to filter data in real time. To illustrate this functionality, let us create a quick example that uses a TextInput component to filter the items in a List component.

Firstly, we will create the List and TextInput. Then we will populate the ListCollection with some data:

var data:Array =
[
	{ label: "Apple" },
	{ label: "Banana" },
	{ label: "Cherry" },
	{ label: "Grape" },
	{ label: "Lemon" },
	{ label: "Peach" },
	{ label: "Strawberry" },
	{ label: "Watermelon" },
];
var collection:ListCollection = new ListCollection(data);

var list:List = new List();
list.dataProvider = collection;
this.addChild(list);

var input:TextInput = new TextInput();
this.addChild(input);

Now, we would like to filter the items displayed in the List when the TextInput is modified. To accomplish this, we will listen for Event.CHANGE and modify the filterFunction property:

input.addEventListener(Event.CHANGE, function():void
{
   if(input.text.length === 0)
   {
       collection.filterFunction = null;
       return;
   }
   collection.filterFunction = function(item:Object):Boolean
   {
       var itemText:String = item.label.toLowerCase();
       var filterText:String = input.text.toLowerCase();
       return itemText.indexOf( filterText ) >= 0;
   };
});

The filterFunction is called for each item in the ListCollection. If it returns true, the item is displayed and if it returns false, the item is hidden.

Get started with Feathers 3.2.0

You can find the Feathers UI 3.2.0 release notes on the project’s Github page. Developers are encouraged to download the latest stable build from the Feathers website.

Comments are closed.