class PageIndicator
package feathers.controls
extends FeathersControl › MeasureSprite › ValidatingSprite
implements IFocusObject, IIndexSelector
Displays a series of dots or other symbols, usually corresponding to a page
index in another UI control, such as PageNavigator
.
The following example creates a page indicator, sets its range and selected index, and lsitens for when the selection changes:
var pages = new PageIndicator();
pages.maxSelectedIndex = 5;
pages.selectedIndex = 1;
pages.addEventListener(Event.CHANGE, (event:Event) -> {
var pages = cast(event.currentTarget, PageIndicator);
trace("PageIndicator changed: " + pages.selectedIndex);
});
Events:
openfl.events.Event.CHANGE | Dispatched when
|
---|
1.0.0
.See also:
Static variables
staticfinalread onlyCHILD_VARIANT_TOGGLE_BUTTON:String = "pageIndicator_toggleButton"
The variant used to style the toggle button child components in a theme.
To override this default variant, set the
PageIndicator.customToggleButtonVariant
property.
1.0.0
.See also:
Constructor
new(maxSelectedIndex:Int = -1, ?changeListener:Event ‑> Void)
Creates a new PageIndicator
object.
1.0.0
.Variables
backgroundSkin:DisplayObject
The default background skin to display behind the buttons.
The following example passes a bitmap for the page indicator to use as a background skin:
pages.backgroundSkin = new Bitmap(bitmapData);
1.0.0
.See also:
customToggleButtonVariant:String
A custom variant to set on all toggle buttons, instead of
PageIndicator.CHILD_VARIANT_TOGGLE_BUTTON
.
The customToggleButtonVariant
will be not be used if the result of
toggleButtonRecycler.create()
already has a variant set.
1.0.0
.See also:
disabledBackgroundSkin:DisplayObject
A background skin to display behind the buttons when the page indicator is disabled.
The following example gives the page indicator a disabled background skin:
pages.disabledBackgroundSkin = new Bitmap(bitmapData);
pages.enabled = false;
1.0.0
.See also:
interactionMode:PageIndicatorInteractionMode
Determines how the selected index changes when the page indicator is clicked or tapped. If precise, the exact page must be chosen. If previous/next, the selection increases or decreases by one. Previous/next interaction is recommended on mobile, due to the low precision of touches.
In the following example, the interaction mode is changed to precise:
pages.interactionMode = PRECISE;
1.0.0
.layout:ILayout
The layout algorithm used to position and size the buttons.
By default, if no layout is provided by the time that the page indicator initializes, a default layout that displays items horizontally will be created.
The following example tells the page indicator to use a custom layout:
var layout = new HorizontalDistributedLayout();
layout.maxItemWidth = 300.0;
pages.layout = layout;
1.0.0
.toggleButtonRecycler:AbstractDisplayObjectRecycler<Dynamic, PageIndicatorItemState, ToggleButton>
Manages toggle buttons used by the page indicator.
In the following example, the page indicator uses a custom toggle button:
pages.toggleButtonRecycler = DisplayObjectRecycler.withClass(ToggleButtonSubClass);
1.0.0
.Methods
indexToToggleButton(index:Int):ToggleButton
Returns the current toggle button used to render the item at the
specified index in the data provider. May return null
if an item
doesn't currently have a toggle button.
1.0.0
.