class TabBar
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements IFocusObject, IDataSelector<Dynamic>, IIndexSelector
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 also:
Static variables
staticfinalread onlyCHILD_VARIANT_TAB:String = "tabBar_tab"
The variant used to style the tab child components in a theme.
1.0.0
.See also:
Constructor
Variables
backgroundSkin:DisplayObject
The default background skin to display behind the tabs.
The following example passes a bitmap for the tab bar to use as a background skin:
tabBar.backgroundSkin = new Bitmap(bitmapData);
1.0.0
.See also:
dataProvider:IFlatCollection<Dynamic>
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 also:
disabledBackgroundSkin:DisplayObject
A background skin to display behind the tabs when the tab bar is disabled.
The following example gives the tab bar a disabled background skin:
tabBar.disabledBackgroundSkin = new Bitmap(bitmapData);
tabBar.enabled = false;
1.0.0
.See also:
layout:ILayout
The layout algorithm used to position and size the tabs.
By default, if no layout is provided by the time that the tab bar initializes, a default layout that displays items horizontally will be created.
The following example tells the tab bar to use a custom layout:
var layout = new HorizontalDistributedLayout();
layout.maxItemWidth = 300.0;
tabBar.layout = layout;
1.0.0
.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.tabRecycler = 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
.