class TabBar
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements IDataSelector<Dynamic>
A line of tabs, where one may be selected at a time.
The following example sets the data provider, tells the tabs how to interpret the data, selects the second tab, and listens for when the selection changes:
var tabs = new TabBar();
tabs.dataProvider = new ArrayCollection(
[
{ text: "Latest Posts" },
{ text: "Profile" },
{ text: "Settings" }
]);
tabBar.itemToText = (item:Dynamic) ->
{
return item.text;
};
tabs.selectedIndex = 1;
tabs.addEventListener(Event.CHANGE, tabs_changeHandler);
this.addChild(tabs);
1.0.0
.See:
Constructor
Variables
dataProvider:IFlatCollection<Dynamic> = null
The collection of data displayed by the tab bar.
The following example passes in a data provider and tells the tabs how to interpret the data:
tabBar.dataProvider = new ArrayCollection(
[
{ text: "Latest Posts" },
{ text: "Profile" },
{ text: "Settings" }
]);
tabBar.itemToText = (item:Dynamic) ->
{
return item.text;
};
1.0.0
.See:
tabRecycler:DisplayObjectRecycler<Dynamic, TabBarItemState, ToggleButton> = DisplayObjectRecycler.withClass(ToggleButton)
Manages tabs used by the tab bar.
In the following example, the tab bar uses a custom tab renderer class:
tabBar.itemRendererRecycler = DisplayObjectRecycler.withClass(ToggleButton);
1.0.0
.Methods
dynamicitemToText (data:Dynamic):String
Converts an item to text to display within tab bar. By default, the
toString()
method is called to convert an item to text. This method
may be replaced to provide custom text.
For example, consider the following item:
{ text: "Example Item" }
If the TabBar
should display the text "Example Item", a custom
implementation of itemToText()
might look like this:
tabBar.itemToText = (item:Dynamic) ->
{
return item.text;
};
1.0.0
.