Package com.bit101.components
Class public class ComboBox
Inheritance ComboBox InheritanceComponent Inheritance flash.display.Sprite



Public Properties
  Property Defined By
    alternateColor : uint
Sets / gets the color for alternate rows if alternateRows is set to true.
ComboBox
    alternateRows : Boolean
Sets / gets whether or not every other row will be colored with the alternate color.
ComboBox
    defaultColor : uint
Sets/gets the default background color of list items.
ComboBox
    defaultLabel : String
Sets / gets the label that will be shown if no item is selected.
ComboBox
  Inherited enabled : Boolean
Sets/gets whether this component is enabled or not.
Component
  Inherited height : Number
[override] Sets/gets the height of the component.
Component
    items : Array
Sets / gets the list of items to be shown.
ComboBox
    listItemClass : Class
Sets / gets the class used to render list items.
ComboBox
    listItemHeight : Number
Sets the height of each list item.
ComboBox
    numVisibleItems : int
Sets / gets the number of visible items in the drop down list.
ComboBox
    openPosition : String
Sets / gets the position the list will open on: top or bottom.
ComboBox
    rolloverColor : uint
Sets/gets the rollover background color of list items.
ComboBox
    selectedColor : uint
Sets/gets the selected background color of list items.
ComboBox
    selectedIndex : int
Sets / gets the index of the selected list item.
ComboBox
    selectedItem : Object
Sets / gets the item in the list, if it exists.
ComboBox
  Inherited tag : int
Sets/gets in integer that can identify the component.
Component
  Inherited width : Number
[override] Sets/gets the width of the component.
Component
  Inherited x : Number
[override] [write-only] Overrides the setter for x to always place the component on a whole pixel.
Component
  Inherited y : Number
[override] [write-only] Overrides the setter for y to always place the component on a whole pixel.
Component
Protected Properties
  Property Defined By
    _defaultLabel : String
ComboBox
    _dropDownButton : PushButton
ComboBox
  Inherited _enabled : Boolean = true
Component
  Inherited _height : Number = 0
Component
    _items : Array
ComboBox
    _labelButton : PushButton
ComboBox
    _list : List
ComboBox
    _numVisibleItems : int = 6
ComboBox
    _open : Boolean = false
ComboBox
    _openPosition : String = bottom
ComboBox
  Inherited Ronda : Class
Component
    _stage : Stage
ComboBox
  Inherited _tag : int = -1
Component
  Inherited _width : Number = 0
Component
Public Methods
  Method Defined By
   
ComboBox(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, defaultLabel:String, items:Array = null)
Constructor
ComboBox
   
addItem(item:Object):void
Adds an item to the list.
ComboBox
   
addItemAt(item:Object, index:int):void
Adds an item to the list at the specified index.
ComboBox
   
draw():void
[override]
ComboBox
  Inherited
initStage(stage:Stage):void
[static] Utility method to set up usual stage align and scaling.
Component
  Inherited
move(xpos:Number, ypos:Number):void
Moves the component to the specified position.
Component
   
removeAll():void
Removes all items from the list.
ComboBox
   
removeItem(item:Object):void
Removes the referenced item from the list.
ComboBox
   
removeItemAt(index:int):void
Removes the item from the list at the specified index
ComboBox
  Inherited
setSize(w:Number, h:Number):void
Sets the size of the component.
Component
Protected Methods
  Method Defined By
   
addChildren():void
[override] Creates and adds the child display objects of this component.
ComboBox
  Inherited
getShadow(dist:Number, knockout:Boolean = false):DropShadowFilter
DropShadowFilter factory method, used in many of the components.
Component
   
init():void
[override] Initilizes the component.
ComboBox
  Inherited
invalidate():void
Marks the component to be redrawn on the next frame.
Component
   
onAddedToStage(event:Event):void
Called when the component is added to the stage.
ComboBox
   
onDropDown(event:MouseEvent):void
Called when one of the top buttons is pressed.
ComboBox
  Inherited
onInvalidate(event:Event):void
Called one frame after invalidate is called.
Component
   
onRemovedFromStage(event:Event):void
Called when the component is removed from the stage.
ComboBox
   
onSelect(event:Event):void
Called when an item in the list is selected.
ComboBox
   
onStageClick(event:MouseEvent):void
Called when the mouse is clicked somewhere outside of the combo box when the list is open.
ComboBox
   
removeList():void
Removes the list from the stage.
ComboBox
   
Determines what to use for the main button label and sets it.
ComboBox
Public Constants
  Constant Defined By
    BOTTOM : String = bottom
[static]
ComboBox
  Inherited DRAW : String = draw
[static]
Component
    TOP : String = top
[static]
ComboBox
Property Detail
_defaultLabel property
protected var _defaultLabel:String

_dropDownButton property  
protected var _dropDownButton:PushButton

_items property  
protected var _items:Array

_labelButton property  
protected var _labelButton:PushButton

_list property  
protected var _list:List

_numVisibleItems property  
protected var _numVisibleItems:int = 6

_open property  
protected var _open:Boolean = false

_openPosition property  
protected var _openPosition:String = bottom

_stage property  
protected var _stage:Stage

alternateColor property  
alternateColor:uint

Sets / gets the color for alternate rows if alternateRows is set to true.


Implementation
    public function get alternateColor():uint
    public function set alternateColor(value:uint):void
alternateRows property  
alternateRows:Boolean

Sets / gets whether or not every other row will be colored with the alternate color.


Implementation
    public function get alternateRows():Boolean
    public function set alternateRows(value:Boolean):void
defaultColor property  
defaultColor:uint

Sets/gets the default background color of list items.


Implementation
    public function get defaultColor():uint
    public function set defaultColor(value:uint):void
defaultLabel property  
defaultLabel:String

Sets / gets the label that will be shown if no item is selected.


Implementation
    public function get defaultLabel():String
    public function set defaultLabel(value:String):void
items property  
items:Array

Sets / gets the list of items to be shown.


Implementation
    public function get items():Array
    public function set items(value:Array):void
listItemClass property  
listItemClass:Class

Sets / gets the class used to render list items. Must extend ListItem.


Implementation
    public function get listItemClass():Class
    public function set listItemClass(value:Class):void
listItemHeight property  
listItemHeight:Number

Sets the height of each list item.


Implementation
    public function get listItemHeight():Number
    public function set listItemHeight(value:Number):void
numVisibleItems property  
numVisibleItems:int

Sets / gets the number of visible items in the drop down list. i.e. the height of the list.


Implementation
    public function get numVisibleItems():int
    public function set numVisibleItems(value:int):void
openPosition property  
openPosition:String

Sets / gets the position the list will open on: top or bottom.


Implementation
    public function get openPosition():String
    public function set openPosition(value:String):void
rolloverColor property  
rolloverColor:uint

Sets/gets the rollover background color of list items.


Implementation
    public function get rolloverColor():uint
    public function set rolloverColor(value:uint):void
selectedColor property  
selectedColor:uint

Sets/gets the selected background color of list items.


Implementation
    public function get selectedColor():uint
    public function set selectedColor(value:uint):void
selectedIndex property  
selectedIndex:int

Sets / gets the index of the selected list item.


Implementation
    public function get selectedIndex():int
    public function set selectedIndex(value:int):void
selectedItem property  
selectedItem:Object

Sets / gets the item in the list, if it exists.


Implementation
    public function get selectedItem():Object
    public function set selectedItem(value:Object):void
Constructor Detail
ComboBox () Constructor
public function ComboBox(parent:DisplayObjectContainer = null, xpos:Number = 0, ypos:Number = 0, defaultLabel:String, items:Array = null)

Constructor

Parameters
parent:DisplayObjectContainer (default = null) — The parent DisplayObjectContainer on which to add this List.
 
xpos:Number (default = 0) — The x position to place this component.
 
ypos:Number (default = 0) — The y position to place this component.
 
defaultLabel:String — The label to show when no item is selected.
 
items:Array (default = null) — An array of items to display in the list. Either strings or objects with label property.
Method Detail
addChildren () method
override protected function addChildren():void

Creates and adds the child display objects of this component.

addItem () method  
public function addItem(item:Object):void

Adds an item to the list.

Parameters

item:Object — The item to add. Can be a string or an object containing a string property named label.
addItemAt () method  
public function addItemAt(item:Object, index:int):void

Adds an item to the list at the specified index.

Parameters

item:Object — The item to add. Can be a string or an object containing a string property named label.
 
index:int — The index at which to add the item.
draw () method  
override public function draw():void

init () method  
override protected function init():void

Initilizes the component.

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

Called when the component is added to the stage.

Parameters

event:Event
onDropDown () method  
protected function onDropDown(event:MouseEvent):void

Called when one of the top buttons is pressed. Either opens or closes the list.

Parameters

event:MouseEvent
onRemovedFromStage () method  
protected function onRemovedFromStage(event:Event):void

Called when the component is removed from the stage.

Parameters

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

Called when an item in the list is selected. Displays that item in the label button.

Parameters

event:Event
onStageClick () method  
protected function onStageClick(event:MouseEvent):void

Called when the mouse is clicked somewhere outside of the combo box when the list is open. Closes the list.

Parameters

event:MouseEvent
removeAll () method  
public function removeAll():void

Removes all items from the list.

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

Removes the referenced item from the list.

Parameters

item:Object — The item to remove. If a string, must match the item containing that string. If an object, must be a reference to the exact same object.
removeItemAt () method  
public function removeItemAt(index:int):void

Removes the item from the list at the specified index

Parameters

index:int — The index of the item to remove.
removeList () method  
protected function removeList():void

Removes the list from the stage.

setLabelButtonLabel () method  
protected function setLabelButtonLabel():void

Determines what to use for the main button label and sets it.

Constant Detail
BOTTOM Constant
public static const BOTTOM:String = bottom

TOP Constant  
public static const TOP:String = top