Packagefeathers.core
Classpublic class ToggleGroup
InheritanceToggleGroup Inheritance EventDispatcher Inheritance Object

Controls the selection of two or more IToggle instances where only one may be selected at a time.

See also

IToggle


Public Properties
 PropertyDefined By
  isSelectionRequired : Boolean
Determines if the user can deselect the currently selected item or not.
ToggleGroup
  selectedIndex : int
The index of the currently selected toggle.
ToggleGroup
  selectedItem : IToggle
The currently selected toggle.
ToggleGroup
Public Methods
 MethodDefined By
  
Constructor.
ToggleGroup
 Inherited
addEventListener(type:String, listener:Function):void
Registers an event listener at a certain object.
EventDispatcher
  
addItem(item:IToggle):void
Adds a toggle to the group.
ToggleGroup
 Inherited
dispatchEvent(event:Event):void
Dispatches an event to all objects that have registered listeners for its type.
EventDispatcher
 Inherited
dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void
Dispatches an event with the given parameters to all objects that have registered listeners for the given type.
EventDispatcher
 Inherited
hasEventListener(type:String):Boolean
Returns if there are listeners registered for a certain event type.
EventDispatcher
  
hasItem(item:IToggle):Boolean
Determines if the group includes the specified item.
ToggleGroup
  
Removes all toggles from the group.
ToggleGroup
 Inherited
removeEventListener(type:String, listener:Function):void
Removes an event listener from the object.
EventDispatcher
 Inherited
removeEventListeners(type:String = null):void
Removes all event listeners with a certain type, or all of them if type is null.
EventDispatcher
  
removeItem(item:IToggle):void
Removes a toggle from the group.
ToggleGroup
Events
 Event Summary Defined By
  Dispatched when the selection changes.ToggleGroup
Property Detail
isSelectionRequiredproperty
isSelectionRequired:Boolean

Determines if the user can deselect the currently selected item or not. The selection may always be cleared programmatically by setting the selected index to -1 or the selected item to null.

If isSelectionRequired is set to true and the toggle group has items that were added previously, and there is no currently selected item, the item at index 0 will be selected automatically.


Implementation
    public function get isSelectionRequired():Boolean
    public function set isSelectionRequired(value:Boolean):void
selectedIndexproperty 
selectedIndex:int

The index of the currently selected toggle.


Implementation
    public function get selectedIndex():int
    public function set selectedIndex(value:int):void
selectedItemproperty 
selectedItem:IToggle

The currently selected toggle.


Implementation
    public function get selectedItem():IToggle
    public function set selectedItem(value:IToggle):void
Constructor Detail
ToggleGroup()Constructor
public function ToggleGroup()

Constructor.

Method Detail
addItem()method
public function addItem(item:IToggle):void

Adds a toggle to the group. If it is the first item added to the group, and isSelectionRequired is true, it will be selected automatically.

Parameters

item:IToggle

hasItem()method 
public function hasItem(item:IToggle):Boolean

Determines if the group includes the specified item.

Parameters

item:IToggle

Returns
Boolean
removeAllItems()method 
public function removeAllItems():void

Removes all toggles from the group. No item will be selected.

removeItem()method 
public function removeItem(item:IToggle):void

Removes a toggle from the group. If the item being removed is selected and isSelectionRequired is true, the final item will be selected. If isSelectionRequired is false instead, no item will be selected.

Parameters

item:IToggle

Event Detail
change Event
Event Object Type: starling.events.Event
Event.type property = starling.events.Event.CHANGE

Dispatched when the selection changes.

An event type to be utilized in custom events. Not used by Starling right now.