GODPAPER | All Packages | All Classes | Index | Frames No Frames |
ToggleGroup

Package | feathers.core
Class | public class ToggleGroup
Inheritance | ToggleGroup EventDispatcher Object

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

See also

IToggle

Public Properties

| Property | Defined 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
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | ToggleGroup() Constructor. | ToggleGroup
|  | 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
|  | dispatchEvent(event:Event):void Dispatches an event to all objects that have registered listeners for its type. | EventDispatcher
|  | 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
|  | 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
|  | removeAllItems():void Removes all toggles from the group. | ToggleGroup
|  | removeEventListener(type:String, listener:Function):void Removes an event listener from the object. | EventDispatcher
|  | 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
--- | --- | --- | ---
|  | change | Dispatched when the selection changes. | ToggleGroup

Property Detail

isSelectionRequired | property

`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`

selectedIndex | property |

`selectedIndex:int`

The index of the currently selected toggle.

Implementation
`public function get selectedIndex():int`
`public function set selectedIndex(value:int):void`

selectedItem | property |

`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.

Thu Jan 16 2014, 01:11 PM +08:00