Packagekm.components
Classpublic class List
InheritanceList Inheritance ScrollPane Inheritance UIComponent Inheritance flash.display.Sprite
SubclassesMenu

The List component class.



Public Properties
 PropertyDefined by
  allowMultipleSelection : Boolean
Gets or sets a Boolean value indicating if more than one item can be selected.
List
  altColorTransform : ColorTransform
Gets or sets a color transform for odd numbered rows.
List
 Inheritedbackground : Image
>> Reference to the background image.
ScrollPane
 Inheritedduotone : Array
The duotone property can be used to convert the colors of the component into duotone.
UIComponent
 Inheritedenabled : Boolean
Specifies if the component is enabled.
If a component is disabled, it will be turned into grayscale and become partly transparent.
UIComponent
 Inheritedheight : Number
UIComponent
  htmlLabels : Boolean
Gets or sets a Boolean value indicating if item labels should be displayed as html text or plain text.
List
  iconField : String
Gets or sets the name of the field that contains the item label icon.
List
  labelField : String
Gets or sets the name of the field that contains the item label text.
List
  length : uint
[read-only] Gets the number of items in the list.
List
  listItem : ListItem
[read-only] >> Reference to the default list item.
List
 Inheritedmargin : int
The margin between the bounding box of the background and the sub components inside.
ScrollPane
  onChange : Function
onChange handler.
List
  selectable : Boolean
Gets or sets a Boolean value indicating if items can be selected.
List
  selectedIndex : int
Gets or sets the index of the selected item.
List
  selectedIndices : Array
Gets or sets an array containing the indices of the selected items.
List
  selectedItem : Object
Gets or sets the selected item.
List
  selectedItems : Array
Gets or sets an array that containing the selected items.
List
 InheritedtoolTip : String
Text to use as toolTip when ToolTip is enabled.
UIComponent
 InheritedvScrollBar : ScrollBar
>> Reference to the vertical scrollBar.
ScrollPane
 Inheritedwidth : Number
UIComponent
 Inheritedx : Number
UIComponent
 Inheritedy : Number
UIComponent
Public Methods
 MethodDefined by
  
List()
List
  
addItem(item:Object):void
Adds an item to the end of the item list.
List
  
addItemAt(item:Object, index:int):void
Adds an item at the specified index.
List
  
addItemsAt(items:Array, index:int):void
Inserts multiple items at the specified index.
List
  
Clears the selected items in the list.
List
 Inherited
clone():*
Returns a clone of the component.
The skin of the component is cloned but other things like the text of a label or the items of a list aren't.
UIComponent
  
getAll():Array
Retrieves all items.
List
  
getItemAt(index:int):Object
Retrieves the item at the specified index.
List
  
getItemIndex(item:Object):int
Retrieves the index of the specified item.
List
  
isItemSelected(item:Object):Boolean
Checks if the specified item is selected.
List
 Inherited
move(x:int, y:int, animationMode:int = 0, animationFrames:int = 12, easeInOut:Boolean = false):void
Moves the component to the specified coordinates.
UIComponent
  
removeAll():void
Removes all items from the list.
List
  
removeItem(item:Object):Object
Removes the specified item from the list.
List
  
removeItemAt(index:int):Object
Removes the item at the specified index position from the list.
List
  
Removes all selected items from the list.
List
  
replaceItemAt(item:Object, index:int):Object
Replaces the item at the specified index with another item.
List
  
scrollToIndex(index:int):void
Scrolls the list to the item at the specified index.
List
  
selectAll():void
Selects all items.
List
  
setDataXML(data:*, sort:int = 0, labelFunction:Function = null, iconFunction:Function = null):void
Set the list data.
data can be of the type XML or URLRequest.
sort can be 0 (no sort), 1 (ascending), 2 (descending).
iconFunction if provided should be a function that accepts one parameter for the item object and returns the icon bitmap data.
List
  
setItemArray(itemArray:Array):void
Specifies the array to use for items.
List
 Inherited
setProperties(o:Object):void
Sets a number of properties at once.
UIComponent
 Inherited
setSize(w:int, h:int):void
Sets the size width and height.
UIComponent
  
shuffleItems():void
Shuffles all items.
List
  
sortItemsOn(field:String, options:Object = null):*
Sorts the items of the list according to one or more item fields.
List
Events
 EventSummaryDefined by
 Inherited The animationComplete event is broadcasted when an animated move is completed.UIComponent
   The change event is broadcasted when a different item is selected.
When the selection is changed by scripting, the event is not broadcasted.
It's also possible to use the onChange handler.
List
   The noChange event is broadcasted when an already selected item is clicked again.List
   The setDataComplete event is broadcasted when the setDataXML function has completed.List
   The setDataError event is broadcasted when the setDataXML function has failed.List
Property detail
allowMultipleSelectionproperty
allowMultipleSelection:Boolean  [read-write]

Gets or sets a Boolean value indicating if more than one item can be selected.

Implementation
    public function get allowMultipleSelection():Boolean
    public function set allowMultipleSelection(value:Boolean):void
altColorTransformproperty 
altColorTransform:ColorTransform  [read-write]

Gets or sets a color transform for odd numbered rows.

Implementation
    public function get altColorTransform():ColorTransform
    public function set altColorTransform(value:ColorTransform):void
htmlLabelsproperty 
htmlLabels:Boolean  [read-write]

Gets or sets a Boolean value indicating if item labels should be displayed as html text or plain text.

Implementation
    public function get htmlLabels():Boolean
    public function set htmlLabels(value:Boolean):void
iconFieldproperty 
iconField:String  [read-write]

Gets or sets the name of the field that contains the item label icon.

Implementation
    public function get iconField():String
    public function set iconField(value:String):void
labelFieldproperty 
labelField:String  [read-write]

Gets or sets the name of the field that contains the item label text.

Implementation
    public function get labelField():String
    public function set labelField(value:String):void
lengthproperty 
length:uint  [read-only]

Gets the number of items in the list.

Implementation
    public function get length():uint
listItemproperty 
listItem:ListItem  [read-only]

>> Reference to the default list item.

Implementation
    public function get listItem():ListItem

See also

onChangeproperty 
public var onChange:Function

onChange handler.

selectableproperty 
selectable:Boolean  [read-write]

Gets or sets a Boolean value indicating if items can be selected.

Implementation
    public function get selectable():Boolean
    public function set selectable(value:Boolean):void
selectedIndexproperty 
selectedIndex:int  [read-write]

Gets or sets the index of the selected item.

Implementation
    public function get selectedIndex():int
    public function set selectedIndex(value:int):void
selectedIndicesproperty 
selectedIndices:Array  [read-write]

Gets or sets an array containing the indices of the selected items.

Implementation
    public function get selectedIndices():Array
    public function set selectedIndices(value:Array):void
selectedItemproperty 
selectedItem:Object  [read-write]

Gets or sets the selected item.

Implementation
    public function get selectedItem():Object
    public function set selectedItem(value:Object):void
selectedItemsproperty 
selectedItems:Array  [read-write]

Gets or sets an array that containing the selected items.

Implementation
    public function get selectedItems():Array
    public function set selectedItems(value:Array):void
Constructor detail
List()constructor
public function List()
Method detail
addItem()method
public function addItem(item:Object):void

Adds an item to the end of the item list.

Parameters
item:Object — The item to add.
addItemAt()method 
public function addItemAt(item:Object, index:int):void

Adds an item at the specified index.

Parameters
item:Object — The item to add.
 
index:int — The index where the item has to be added before. You can use a negative value to specify a position relative to the end of the list (for example, -1 is the last item of the list).
addItemsAt()method 
public function addItemsAt(items:Array, index:int):void

Inserts multiple items at the specified index.

Parameters
items:Array — The items to be added.
 
index:int — The index where the items have to be added before. You can use a negative value to specify a position relative to the end of the list (for example, -1 is the last item of the list).
clearSelection()method 
public function clearSelection():void

Clears the selected items in the list.

getAll()method 
public function getAll():Array

Retrieves all items.

Returns
Array — All items.
getItemAt()method 
public function getItemAt(index:int):Object

Retrieves the item at the specified index.

Parameters
index:int — The index of the item to retrieve. You can use a negative value to specify a position relative to the end of the list (for example, -1 is the last item of the list).

Returns
Object — The retrieved item.
getItemIndex()method 
public function getItemIndex(item:Object):int

Retrieves the index of the specified item.

Parameters
item:Object — The item to search for.

Returns
int — The index of the specified item or -1 when the item can't be found.
isItemSelected()method 
public function isItemSelected(item:Object):Boolean

Checks if the specified item is selected.

Parameters
item:Object — The item to search for.

Returns
Boolean — A Boolean value indicating if the item is currently selected or not.
removeAll()method 
public function removeAll():void

Removes all items from the list.

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

Removes the specified item from the list.

Parameters
item:Object — The item to remove.

Returns
Object — The removed item.
removeItemAt()method 
public function removeItemAt(index:int):Object

Removes the item at the specified index position from the list.

Parameters
index:int — The index of the item to remove. You can use a negative value to specify a position relative to the end of the list (for example, -1 is the last item of the list).

Returns
Object — The removed item.
removeSelectedItems()method 
public function removeSelectedItems():Array

Removes all selected items from the list.

Returns
Array — The removed items.
replaceItemAt()method 
public function replaceItemAt(item:Object, index:int):Object

Replaces the item at the specified index with another item.

Parameters
item:Object — The item to add.
 
index:int — The index where the item has to be replaced. You can use a negative value to specify a position relative to the end of the list (for example, -1 is the last item of the list).

Returns
Object — The removed item.
scrollToIndex()method 
public function scrollToIndex(index:int):void

Scrolls the list to the item at the specified index. You can use a negative value to specify a position relative to the end of the list (for example, -1 is the last item of the list).

Parameters
index:int
selectAll()method 
public function selectAll():void

Selects all items.

setDataXML()method 
public function setDataXML(data:*, sort:int = 0, labelFunction:Function = null, iconFunction:Function = null):void

Set the list data.
data can be of the type XML or URLRequest.
sort can be 0 (no sort), 1 (ascending), 2 (descending).
iconFunction if provided should be a function that accepts one parameter for the item object and returns the icon bitmap data.

Parameters
data:*
 
sort:int (default = 0)
 
labelFunction:Function (default = null)
 
iconFunction:Function (default = null)

Example
 import km.components.*;
 import km.skins.*;

 function myFunction():void {
  trace('item function');
 }

 var listData:XML = 
  <data>
         <item label='Mail account 1' value ='account 1' />
         <item label='Mail account 2' value ='account 2' disabled='true' />
         <item label='Mail account 3' value ='account 3' />
  </data>;

 var list:List = new List();
 ScriptedSkin.applyTo(list);
 list.setSize(140, 100);
 list.move(10,10);
 addChild(list);

 list.setDataXML(listData);
 

setItemArray()method 
public function setItemArray(itemArray:Array):void

Specifies the array to use for items. By default an internal array is used but this function allows you to specify another one.

Parameters
itemArray:Array — The array to use.
shuffleItems()method 
public function shuffleItems():void

Shuffles all items.

sortItemsOn()method 
public function sortItemsOn(field:String, options:Object = null):*

Sorts the items of the list according to one or more item fields.

Parameters
field:String — The field to sort on.
 
options:Object (default = null) — Optional options to control the sorting process.

Returns
*

See also

Array.sortOn
Event detail
changeevent 
Event object type: flash.events.Event

The change event is broadcasted when a different item is selected.
When the selection is changed by scripting, the event is not broadcasted.
It's also possible to use the onChange handler.

noChangeevent  
Event object type: flash.events.Event

The noChange event is broadcasted when an already selected item is clicked again.

setDataCompleteevent  
Event object type: flash.events.Event

The setDataComplete event is broadcasted when the setDataXML function has completed.

setDataErrorevent  
Event object type: flash.events.Event

The setDataError event is broadcasted when the setDataXML function has failed.