Main Page | Packages | Class Tree | Index | Help

com.bjc.controls

class ComboBox

MovieClip
  |
  +--com.bjc.core.BJCComponent
        |
        +--com.bjc.core.LabelWrapper
              |
              +--com.bjc.controls.ComboBox


class ComboBox
extends LabelWrapper

A basic combo box for displaying and choosing amongst different values

Events:

change - Fired whenever the user makes a choice from the drop down list, changing the current selection.
focus - Fired whenever the component receives focus.
killFocus - Fired whenever the component loses focus.
tabFocus - Fired whenever the component receives focus by pressing the TAB key.


Author:
Flashloaded - www.flashloaded.com


Field Summary

public
addEventListener: Function
See the EventDispatcher Class in Flash Help

public
changeHandler: Function
Can be used to assign a direct event handler to the component instance.

public
clickHandler: Function
Can be used to assign a direct event handler to the component instance.

public
focusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
removeEventListener: Function
See the EventDispatcher Class in Flash Help

public
tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Fields inherited from class com.bjc.core.BJCComponent

version

Property Summary

public
dataProvider: Array (write)
Sets the array of items used to populate the combo box.

public
dataProvider: Array (read)
Retrieves the array of items used to populate the combo box.

public
highlightColor: Number (write)
Sets the color to use when an item in the drop down list is rolled over.

public
highlightColor: Number (read)
Gets the color used when an item in the drop down list is rolled over.

public
numRows: Number (write)
Sets the number of visible rows displayed when the combo box is open. If there are more items than this value, a scrollbar will appear to allow you to scroll through the items.

public
numRows: Number (read)
Gets the number of visible rows displayed when the combo box is open.

public
rowHeight: Number (write)
Sets the height for the individual rows in the drop down list.

public
rowHeight: Number (read)
Gets the height of the individual rows in the drop down list.

public
scrollBarWidth: Number (write)
Sets the width of the scrollbar used in the drop down list (if needed)

public
scrollBarWidth: Number (read)
Gets the width of the scrollbar used in the drop down list

public
selectedColor: Number (write)
Sets the color to use when an item in the drop down list is clicked on.

public
selectedColor: Number (read)
Gets the color used when an item in the drop down list is clicked on.

public
selectedIndex: Number (write)
Sets the selected item.

public
selectedIndex: Number (read)
Retrieves the number of the currently selected item in the combo box.

public
selectedItem: Number (read-only)
A reference to the currently selected item in the combo box.

Properties inherited from class com.bjc.core.LabelWrapper

align, disabledColor, disableStyles, embedFont, fontColor, fontFace, fontSize, html

Properties inherited from class com.bjc.core.BJCComponent

disabledAlpha, enabled, focusTime, height, keyEnabled, style, width

Constructor

public
ComboBox ( Void)


Method Summary

public
addItem ( item: Object ): Void
Adds a new item to the combo box, tacking it on to the end of the list.

public
addItemAt ( item: Object, index: Number ): Void
Adds a new item to the combo box, placing it in the position specified.

public static
create ( target: MovieClip, id: String, depth: Number, initObj: Object ): ComboBox
Static method used to create an instance of a ComboBox on stage at run time.

public
removeAll ( Void ): Void
Removes all existing items from the combo box.

public
removeItemAt ( index: Number ): Void
Removes the item at the specified index.

Methods inherited from class com.bjc.core.BJCComponent

draw, invalidate, move, remove, setSize



Field Documentation

addEventListener

public var addEventListener: Function
See the EventDispatcher Class in Flash Help

changeHandler

public var changeHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myComboBox.changeHandler = function(){
trace("I was changed.");
}

clickHandler

public var clickHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myComboBox.clickHandler = function(){
trace("I was clicked.");
}

focusHandler

public var focusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myComboBox.focusHandler = function(){
trace("Set focus.");
}

killFocusHandler

public var killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myComboBox.killFocusHandler = function(){
trace("Kill focus.");
}

removeEventListener

public var removeEventListener: Function
See the EventDispatcher Class in Flash Help

tabFocusHandler

public var tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myComboBox.tabFocusHandler = function(){
trace("Tab focus.");
}


Property Documentation

dataProvider

public dataProvider: Array (write)
Sets the array of items used to populate the combo box.

Example:
var myDP:Array = ["item one", "item two", "item three"];
myComboBox.dataProvider = myDP;

dataProvider

public dataProvider: Array (read)
Retrieves the array of items used to populate the combo box.

Example:
var myDP = myComboBox.dataProvider;

highlightColor

public highlightColor: Number (write)
Sets the color to use when an item in the drop down list is rolled over.

Example:
myComboBox.highlightColor = 0xcccccc;

highlightColor

public highlightColor: Number (read)
Gets the color used when an item in the drop down list is rolled over.

Example:
myVar = myComboBox.highlightColor;

numRows

public numRows: Number (write)
Sets the number of visible rows displayed when the combo box is open. If there are more items than this value, a scrollbar will appear to allow you to scroll through the items.

Example:
myComboBox.numRows = 5;

numRows

public numRows: Number (read)
Gets the number of visible rows displayed when the combo box is open.

Example:
myVar = myComboBox.numRows;

rowHeight

public rowHeight: Number (write)
Sets the height for the individual rows in the drop down list.

Example:
myComboBox.rowHeight = 25;

rowHeight

public rowHeight: Number (read)
Gets the height of the individual rows in the drop down list.

Example:
myVar = myComboBox.rowHeight;

scrollBarWidth

public scrollBarWidth: Number (write)
Sets the width of the scrollbar used in the drop down list (if needed)

Example:
myComboBox.scrollBarWidth = 20;

scrollBarWidth

public scrollBarWidth: Number (read)
Gets the width of the scrollbar used in the drop down list

Example:
myVar = myComboBox.scrollBarWidth;

selectedColor

public selectedColor: Number (write)
Sets the color to use when an item in the drop down list is clicked on.

Example:
myComboBox.selectedColor = 0xaaaaaa;

selectedColor

public selectedColor: Number (read)
Gets the color used when an item in the drop down list is clicked on.

Example:
myVar = myComboBox.selectedColor;

selectedIndex

public selectedIndex: Number (write)
Sets the selected item.

Example:
myComboBox.selectedIndex = 5;

selectedIndex

public selectedIndex: Number (read)
Retrieves the number of the currently selected item in the combo box.

Example:
myVar = myComboBox.selectedIndex;

selectedItem

public selectedItem: Number (read-only)
A reference to the currently selected item in the combo box.

Example:
myVar = myComboBox.selectedItem;
myLabel = myVar.label;


Constructor Documentation

ComboBox

public function ComboBox(Void)

Method Documentation

addItem

public function addItem(item: Object): Void
Adds a new item to the combo box, tacking it on to the end of the list.

Parameters:
item
an object containing minimally a parameter called label. This would be the string displayed in the combo box. The object can also contain any other properties, usually stored in a data property. Item can also be a simple string itself.
Returns:
nothing

Example:
// using an object
myComboBox.addItem({label:"First item", data:100});
// using a string
myComboBox.addItem("Second Item");

addItemAt

public function addItemAt(item: Object,
 index: Number): Void
Adds a new item to the combo box, placing it in the position specified.

Parameters:
item
an object containing minimally a parameter called label. This would be the string displayed in the combo box. The object can also contain any other properties, usually stored in a data property. Item can also be a simple string itself.
index
the position at which to place the item
Returns:
nothing

Example:
// using an object
myComboBox.addItem({label:"First item", data:100}, 3);
// using a string
myComboBox.addItem("Second Item", 4);

create

public static function create(target: MovieClip,
 id: String,
 depth: Number,
 initObj: Object): ComboBox
Static method used to create an instance of a ComboBox on stage at run time.

Parameters:
target
the movie clip to which the combobox will be attached.
id
the instance name given to the new combobox attached.
depth
the depth at which to attach the new combobox.
initObj
(optional) an object containing any properties you want to assign to the component when it is created
Returns:
a reference to the new combobox attached.

Example:
import com.bjc.controls.ComboBox;
var newComboBox:ComboBox = ComboBox.create(_root, "myComboBox", 0);

removeAll

public function removeAll(Void): Void
Removes all existing items from the combo box.

Returns:
nothing

Example:
myComboBox.removeAll();

removeItemAt

public function removeItemAt(index: Number): Void
Removes the item at the specified index.

Parameters:
index
the position of the item you want to remove
Returns:
nothing

Example:
myComboBox.removeItemAt(1);


The documentation was generated from the following file:


Copyright Flashloaded - www.flashloaded.com