Packageardisia.components.buttonBar
Classpublic class ButtonBarBase
InheritanceButtonBarBase Inheritance spark.components.supportClasses.ButtonBarBase
Implements mx.managers.IFocusManagerComponent
Subclasses ButtonBar, TabBar

Button bar that supports dragging, closing, and animation.

The selectedIndex will change as the user rearranges buttons. In other words, if a selected button is moved from its start position, the selectedIndex will update (although no event will dispatch). Keep this in mind if binding to the selectedIndex.

Use the selectedItem property to determine what button is selected.

View the technical documentation on the Ardisia Labs website for more information.

Default MXML PropertydataProvider



Public Properties
 PropertyDefined By
  closableField : String
The field on the data to look for a boolean value if the button can be closed by clicking the close button skin part.
ButtonBarBase
  duration : Number = 150
The duration of animations in milliseconds.
ButtonBarBase
  easer : IEaser
The default easer to apply to animations.
ButtonBarBase
  isAnimating : Boolean
[read-only] True if a animation is running.
ButtonBarBase
  isDragging : Boolean
[read-only] True if a button is being dragged.
ButtonBarBase
Public Methods
 MethodDefined By
  
ButtonBarBase
  
addButton(data:Object, selected:Boolean):void
Use this method to add a button via animation.
ButtonBarBase
  
End a selected button drag.
ButtonBarBase
  
removeButton(index:int):void
Use this method to remove a button via animation.
ButtonBarBase
  
startButtonDrag(initialX:Number):void
Start dragging the selected button.
ButtonBarBase
Protected Methods
 MethodDefined By
  
Commits the buttonSnapshot to the underlying collection and updates the buttons to reflect the buttonSnapshot.
ButtonBarBase
  
dragHandler(event:Event):void
Handles the events and logic for user initiated dragging.
ButtonBarBase
  
effectHandler(event:EffectEvent):void
Handles the events and logic for effects.
ButtonBarBase
  
eventHandler(event:Event):void
Handles events on the control.
ButtonBarBase
  
Sets up the final animations after a removeSession is finished.
ButtonBarBase
  
Creates and returns a Fade effect on the passed data.
ButtonBarBase
  
Creates and returns a Move animation to move a button to the new position.
ButtonBarBase
  
Creates and returns a resize effect on the passed data.
ButtonBarBase
  
rendererHandler(event:Event):void
Handles events on the renderers.
ButtonBarBase
  
Setup the final animation for a removal session.
ButtonBarBase
  
Creates a vector of SlidingButtonData objects for each button from left to right.
ButtonBarBase
Events
 Event Summary Defined By
  Dispatched when a button is closed via the close button.ButtonBarBase
  Dispatched when a button is about to be closed via the close button.ButtonBarBase
  Dispatched when a ButtonBarButton's closeButtonPart is clicked.ButtonBarBase
  Dispatched when a drag ends.ButtonBarBase
  Dispatched while a button is dragging.ButtonBarBase
  Dispatched when a button drag starts.ButtonBarBase
  Dispatched immediately before a button is dragged.ButtonBarBase
Property Detail
closableFieldproperty
closableField:String

The field on the data to look for a boolean value if the button can be closed by clicking the close button skin part. If not set, the default behaviour is that all buttons are closable.

The default value is "closable".


Implementation
    public function get closableField():String
    public function set closableField(value:String):void
durationproperty 
public var duration:Number = 150

The duration of animations in milliseconds.

Set to 0 to skip animations entirely.

The default value is 150.

easerproperty 
public var easer:IEaser

The default easer to apply to animations.

The default value is spark Linear effect.

isAnimatingproperty 
isAnimating:Boolean  [read-only]

True if a animation is running.

The default value is false.


Implementation
    public function get isAnimating():Boolean
isDraggingproperty 
isDragging:Boolean  [read-only]

True if a button is being dragged.

The default value is false.


Implementation
    public function get isDragging():Boolean
Constructor Detail
ButtonBarBase()Constructor
public function ButtonBarBase()



Method Detail
addButton()method
public function addButton(data:Object, selected:Boolean):void

Use this method to add a button via animation. Use vanilla collection methods to add/edit/remove buttons without animation.

Animated in buttons start with the width defined by the "minWidth" property on the button skin.

Parameters

data:Object — data object to add to the underlying collection
 
selected:Boolean — use true to select the added button

commitButtonSnapshot()method 
protected function commitButtonSnapshot():void

Commits the buttonSnapshot to the underlying collection and updates the buttons to reflect the buttonSnapshot.

Typically called at the end of a user initiated drag.

dragHandler()method 
protected function dragHandler(event:Event):void

Handles the events and logic for user initiated dragging.

Parameters

event:Event — the Event that triggered the handler

effectHandler()method 
protected function effectHandler(event:EffectEvent):void

Handles the events and logic for effects.

Parameters

event:EffectEvent — the EffectEvent that triggered the handler

endButtonDrag()method 
public function endButtonDrag():void

End a selected button drag.

eventHandler()method 
protected function eventHandler(event:Event):void

Handles events on the control.

Parameters

event:Event — the Event that triggered the handler

finalRemoveAnimation()method 
protected function finalRemoveAnimation():void

Sets up the final animations after a removeSession is finished.

getFadeButtonEffect()method 
protected function getFadeButtonEffect(slidingData:ButtonBarButtonData):IEffect

Creates and returns a Fade effect on the passed data.

Parameters

slidingData:ButtonBarButtonData — the SlidingButtonData object that defines the button to be animated

Returns
IEffect — the effect
getMoveButtonEffect()method 
protected function getMoveButtonEffect(slidingData:ButtonBarButtonData):IEffect

Creates and returns a Move animation to move a button to the new position.

Parameters

slidingData:ButtonBarButtonData — the SlidingButtonData object that defines the button to be animated

Returns
IEffect — the effect
getResizeButtonEffect()method 
protected function getResizeButtonEffect(slidingData:ButtonBarButtonData):IEffect

Creates and returns a resize effect on the passed data.

Parameters

slidingData:ButtonBarButtonData — the SlidingButtonData object that defines the button to be animated

Returns
IEffect — the effect
removeButton()method 
public function removeButton(index:int):void

Use this method to remove a button via animation. Use vanilla collection methods to add/edit/remove buttons without animation.

If the mouse is over the removed button when this method is called, only the buttons to the right of the removed button will be removed, and the remaining buttons will not animate into position until the mouse rolls out of the control. Allows the user to remove multiple buttons without moving the mouse.

If the mouse is not over the removed button, the buttons will immediately animate out of existence.

Parameters

index:int — index of the item to be removed

rendererHandler()method 
protected function rendererHandler(event:Event):void

Handles events on the renderers. param event the Event that triggered the handler

Parameters

event:Event

setupFinalRemoveAnimation()method 
protected function setupFinalRemoveAnimation():void

Setup the final animation for a removal session.

startButtonDrag()method 
public function startButtonDrag(initialX:Number):void

Start dragging the selected button.

Parameters

initialX:Number (default = NaN) — Number the x position to start dragging the button

updateButtonSnapshot()method 
protected function updateButtonSnapshot():void

Creates a vector of SlidingButtonData objects for each button from left to right.

This stores a snapshot of the control's state before changes are made via user interaction.

Event Detail
buttonClose Event
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched when a button is closed via the close button.

buttonClosing Event  
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched when a button is about to be closed via the close button. Can be cancelled.

closeButtonClick Event  
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched when a ButtonBarButton's closeButtonPart is clicked.

dragEnd Event  
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched when a drag ends.

dragging Event  
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched while a button is dragging.

dragStart Event  
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched when a button drag starts.

dragStarting Event  
Event Object Type: ardisia.components.buttonBar.events.ButtonBarEvent
ButtonBarEvent.type property = ardisia.components.buttonBar.events.ButtonBarEvent

Dispatched immediately before a button is dragged. Can be cancelled.