Vous êtes sur la page 1sur 51

Package mx.

controls
Class public class Tree
Tree List ListBase ScrollControlBase UIComponent FlexSprite
Inheritance Sprite DisplayObjectContainer InteractiveObject DisplayObject
EventDispatcher Object
ImplementsIIMESupport
The Tree control lets a user view hierarchical data arranged as an expandable tree. Each
item in a tree can be a leaf or a branch. A leaf item is an end point in the tree. A branch
item can contain leaf or branch items, or it can be empty.

By default, a leaf is represented by a text label next to a file icon. A branch is represented
by a text label next to a folder icon, with a disclosure triangle that a user can open to
expose children.

The Tree class uses an ITreeDataDescriptor object to parse and manipulate the data
provider. The default tree data descriptor, an object of the DefaultDataDescriptor class,
supports XML and Object classes; an Object class data provider must have all children in
children fields.

MXML Syntax Hide MXML Syntax

The <mx:Tree> tag inherits all the tag attributes of its superclass, and adds the following
tag attributes:

<mx:Tree
Properties
dataDescriptor="Instance of DefaultDataDescriptor"
dataProvider="null"
dragMoveEnabled="true|false"
firstVisibleItem="First item in the control"
hasRoot="false|true"
itemIcons="null"
maxHorizontalScrollPosition="0"
openItems="null"
showRoot="true|false"

Styles
alternatingItemColors="undefined"
backgroundDisabledColor="0xDDDDDD"
defaultLeafIcon="TreeNodeIcon in assets.swf"
depthColors="undefined"
disclosureClosedIcon="TreeDisclosureClosed in assets.swf"
disclosureOpenIcon="TreeDisclosureOpen in assets.swf"
folderClosedIcon="TreeFolderClosed in assets.swf"
folderOpenIcon="TreeFolderOpen in assets.swf"
indentation="17"
openDuration="250"
openEasingFunction="undefined"
paddingLeft="2"
paddingRight="0"
rollOverColor="0xAADEFF"
selectionColor="0x7FCDFE"
selectionDisabledColor="0xDDDDDD"
selectionEasingFunction="undefined"
textRollOverColor="0x2B333C"
textSelectedColor="0x2B333C"

Events
change="No default"
itemClose="No default"
itemOpen="No default"
itemOpening="No default"
/>

Default MXML PropertydataProvider

View the examples.

See also

mx.controls.treeClasses.ITreeDataDescriptor
mx.controls.treeClasses.DefaultDataDescriptor
Using Data-Driven Controls
Example: Using an item renderer with a Tree control
Example: Using a custom item editor with a Tree control

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties
Property Defined by
accessibilityProperties : AccessibilityProperties
DisplayObject
The current accessibility options for this display object.
allowDragSelection : Boolean = false
ListBase
A flag that indicates whether drag-selection is enabled.
allowMultipleSelection : Boolean
A flag that indicates whether you can allow more than one ListBase
item to be selected at the same time.
alpha : Number
Indicates the alpha transparency value of the object DisplayObject
specified.
baselinePosition : Number
List
The baseline position for the control.
blendMode : String
A value from the BlendMode class that specifies which DisplayObject
blend mode to use.
borderMetrics : EdgeMetrics ScrollControlBase
Returns an EdgeMetrics object that has four properties:
left, top, right, and bottom.
buttonMode : Boolean
Sprite
Specifies the button mode of this sprite.
cacheAsBitmap : Boolean
If set to true, Flash Player caches an internal bitmap DisplayObject
representation of the display object.
cacheHeuristic : Boolean
UIComponent
Used by Flex to suggest bitmap caching for the object.
cachePolicy : String
UIComponent
Specifies the bitmap caching policy for this object.
className : String
UIComponent
The name of this instance's class, such as "Button".
columnCount : int
The number of columns to be displayed in a TileList ListBase
control or items in a HorizontalList control.
columnWidth : Number
ListBase
The width of the control's columns.
constructor : Object
A reference to the class object or constructor function for a Object
given object instance.
contentMouseX : Number
Returns the x position of the mouse, in the content UIComponent
coordinate system.
contentMouseY : Number
Returns the y position of the mouse, in the content UIComponent
coordinate system.
contextMenu : ContextMenu
InteractiveObject
Specifies the context menu associated with this object.
currentState : String
UIComponent
The current view state of the component.
data : Object
The item in the data provider this component should render
ListBase
when this component is used as an item renderer or item
editor.
dataDescriptor : ITreeDataDescriptor
Tree delegates to the data descriptor for information about Tree
the data.
dataProvider : Object
Tree
An object that contains the data to be displayed.
dataTipField : String ListBase
Name of the field in the data provider items to display as
the data tip.
dataTipFunction : Function
User-supplied function to run on each item to determine its ListBase
dataTip.
descriptor : UIComponentDescriptor
Reference to the UIComponentDescriptor, if any, that was
UIComponent
used by the createComponentFromDescriptor() method
to create this UIComponent instance.
document : Object
A reference to the document object associated with this UIComponent
UIComponent.
doubleClickEnabled : Boolean
Specifies whether the UIComponent object receives UIComponent
doubleClick events.
dragEnabled : Boolean
A flag that indicates whether you can drag items out of this ListBase
control and drop them on other controls.
dragMoveEnabled : Boolean
Indicates that items can be moved instead of just copied Tree
from the Tree control as part of a drag-and-drop operation.
dropEnabled : Boolean
A flag that indicates whether dragged items can be dropped ListBase
onto the control.
dropTarget : DisplayObject
Specifies the display object over which the sprite is being Sprite
dragged, or on which the sprite was dropped.
editable : Boolean = false
A flag that indicates whether or not the user can edit items List
in the data provider.
editedItemPosition : Object
The column and row index of the item renderer for the data List
provider item being edited, if any.
editedItemRenderer : IListItemRenderer
A reference to the item renderer in the DataGrid control List
whose item is currently being edited.
editorDataField : String = "text"
The name of the property of the item editor that contains List
the new data for the list item.
editorHeightOffset : Number = 0
The height of the item editor, in pixels, relative to the size List
of the item renderer.
editorUsesEnterKey : Boolean = false
List
A flag that indicates whether the item editor uses Enter key.
editorWidthOffset : Number = 0
The width of the item editor, in pixels, relative to the size of List
the item renderer.
editorXOffset : Number = 0
The x location of the upper-left corner of the item editor, in List
pixels, relative to the upper-left corner of the item.
editorYOffset : Number = 0
The y location of the upper-left corner of the item editor, in List
pixels, relative to the upper-left corner of the item.
enabled : Boolean
UIComponent
Whether the component can accept user interaction.
errorString : String
The text that will be displayed by a component's error tip
UIComponent
when a component is monitored by a Validator and
validation fails.
explicitHeight : Number
Number that specifies the explicit height of the component, UIComponent
in pixels, in the component's coordinates.
explicitMaxHeight : Number
Number that specifies the maximum height of the UIComponent
component, in pixels, in the component's coordinates.
explicitMaxWidth : Number
Number that specifies the maximum width of the UIComponent
component, in pixels, in the component's coordinates.
explicitMinHeight : Number
Number that specifies the minimum height of the UIComponent
component, in pixels, in the component's coordinates.
explicitMinWidth : Number
Number that specifies the minimum width of the UIComponent
component, in pixels, in the component's coordinates.
explicitWidth : Number
Number that specifies the explicit width of the component, UIComponent
in pixels, in the component's coordinates.
filters : Array
An indexed array that contains each filter object currently DisplayObject
associated with the display object.
firstVisibleItem : Object
The item that is currently displayed in the top row of the Tree
tree.
focusEnabled : Boolean UIComponent
Indicates whether the component can receive focus when
clicked on.
focusManager : IFocusManager
Gets the FocusManager that controls focus for this UIComponent
component and its peers.
focusPane : Sprite
UIComponent
The focus pane associated with this object.
focusRect : Object
InteractiveObject
Specifies whether this object displays a focus rectangle.
graphics : Graphics
Specifies the Graphics object that belongs to this sprite Sprite
where vector drawing commands can occur.
hasRoot : Boolean
[read-only] Indicates that the current dataProvider has a
Tree
root item; for example, a single top node in a hierarchical
structure.
height : Number
Number that specifies the height of the component, in UIComponent
pixels, in the parent's coordinates.
hitArea : Sprite
Designates another sprite to serve as the hit area for a Sprite
sprite.
horizontalScrollPolicy : String
A property that indicates whether the horizontal scroll bar is
always on, always off, or automatically changes based on ScrollControlBase
the parameters passed to the setScrollBarProperties()
method.
horizontalScrollPosition : Number
ScrollControlBase
The offset into the content from the left edge.
iconField : String
The name of the field in the data provider object that ListBase
determines what to display as the icon.
iconFunction : Function
A user-supplied function to run on each item to determine ListBase
its icon.
id : String
UIComponent
ID of the component.
imeMode : String
List
Specifies the IME (input method editor) mode.
includeInLayout : Boolean
Specifies whether this component is included in the layout UIComponent
of the parent container.
inheritingStyles : Object
The beginning of this component's chain of inheriting UIComponent
styles.
initialized : Boolean
A flag that determines if an object has been through all
UIComponent
three phases of layout: commitment, measurement, and
layout (provided that any were required).
instanceIndex : int
UIComponent
The index of a repeated component.
instanceIndices : Array
An Array containing the indices required to reference this UIComponent
UIComponent object from its parent document.
isDocument : Boolean
Determines whether this UIComponent instance is a
document object, that is, whether it is at the top of the UIComponent
hierarchy of a Flex application, MXML component, or
ActionScript component.
isPopUp : Boolean
Set to true by the PopUpManager to indicate that UIComponent
component has been popped up.
itemEditor : IFactory
The class factory for the item editor to use for the control, if List
the editable property is set to true.
itemEditorInstance : IListItemRenderer
A reference to the currently active instance of the item List
editor, if it exists.
itemIcons : Object
Tree
An object that specifies the icons for the items.
itemRenderer : IFactory
ListBase
The custom item renderer for the control.
labelField : String
The name of the field in the data provider items to display ListBase
as the label.
labelFunction : Function
A user-supplied function to run on each item to determine ListBase
its label.
listData : BaseListData
When a component is used as a drop-in item renderer or
drop-in item editor, Flex initializes the listData property ListBase
of the component with the additional data from the list
control.
liveScrolling : Boolean = true ScrollControlBase
A flag that indicates whether scrolling is live as the
scrollbar thumb is moved or the view is not updated until
the thumb is released.
loaderInfo : LoaderInfo
Returns a LoaderInfo object containing information about DisplayObject
loading the file to which this display object belongs.
lockedColumnCount : int
ListBase
The index of the first column in the control that scrolls.
lockedRowCount : int
ListBase
The index of the first row in the control that scrolls.
mask : DisplayObject
The calling display object is masked by the specified mask DisplayObject
object.
maxHeight : Number
Number that specifies the maximum height of the UIComponent
component, in pixels, in the component's coordinates.
maxHorizontalScrollPosition : Number
The maximum value for the
Tree
maxHorizontalScrollPosition property for the Tree
control.
maxVerticalScrollPosition : Number
The maximum value for the verticalScrollPosition ScrollControlBase
property.
maxWidth : Number
Number that specifies the maximum width of the UIComponent
component, in pixels, in the component's coordinates.
measuredHeight : Number
UIComponent
The default height of the component, in pixels.
measuredMinHeight : Number
UIComponent
The default minimum height of the component, in pixels.
measuredMinWidth : Number
UIComponent
The default minimum width of the component, in pixels.
measuredWidth : Number
UIComponent
The default width of the component, in pixels.
menuSelectionMode : Boolean = false
A flag that indicates whether menu-style selection should ListBase
be used.
minHeight : Number
Number that specifies the minimum height of the UIComponent
component, in pixels, in the component's coordinates.
minWidth : Number UIComponent
Number that specifies the minimum width of the
component, in pixels, in the component's coordinates.
mouseChildren : Boolean
Determines whether or not the children of the object are DisplayObjectContainer
mouse enabled.
mouseEnabled : Boolean
InteractiveObject
Specifies whether this object receives mouse messages.
mouseFocusEnabled : Boolean
UIComponent
Whether you can receive focus when clicked on.
mouseX : Number
DisplayObject
Indicates the x coordinate of the mouse position, in pixels.
mouseY : Number
DisplayObject
Indicates the y coordinate of the mouse position, in pixels.
name : String
DisplayObject
Indicates the instance name of the DisplayObject.
nestLevel : int
UIComponent
Depth of this object in the containment hierarchy.
nonInheritingStyles : Object
The beginning of this component's chain of non-inheriting UIComponent
styles.
numChildren : int
DisplayObjectContainer
Returns the number of children of this object.
opaqueBackground : Object
Specifies whether the display object is opaque with a DisplayObject
certain background color.
openItems : Object
Tree
The items that have been opened or set opened.
owner : DisplayObjectContainer
UIComponent
The owner of this UIComponent.
parent : DisplayObjectContainer
UIComponent
The parent container or component for this component.
parentApplication : Object
A reference to the Application object that contains this UIComponent
UIComponent instance.
parentDocument : Object
A reference to the parent document object for this UIComponent
UIComponent.
percentHeight : Number
Number that specifies the height of a component as a UIComponent
percentage of its parent's size.
percentWidth : Number UIComponent
Number that specifies the width of a component as a
percentage of its parent's size.
processedDescriptors : Boolean
Set to true after immediate or deferred child creation, UIComponent
depending on which one happens.
prototype : Object
[static] A reference to the prototype object of a class or Object
function object.
rendererIsEditor : Boolean = false
List
Specifies whether the item renderer is also an item editor.
repeater : IRepeater
A reference to the Repeater object in the parent document UIComponent
that produced this UIComponent.
repeaterIndex : int
The index of the item in the data provider of the Repeater UIComponent
that produced this UIComponent.
repeaterIndices : Array
An Array containing the indices of the items in the data
UIComponent
provider of the Repeaters in the parent document that
produced this UIComponent.
repeaters : Array
An Array containing references to the Repeater objects in UIComponent
the parent document that produced this UIComponent.
root : DisplayObject
For a display object in a loaded SWF file, the root
DisplayObject
property is the top-most display object in the portion of the
display list's tree structure represented by that SWF file.
rotation : Number
Indicates the rotation of the DisplayObject instance, in DisplayObject
degrees, from its original orientation.
rowCount : int
ListBase
Number of rows to be displayed.
rowHeight : Number
ListBase
The height of the rows in pixels.
scale9Grid : Rectangle
DisplayObject
The current scaling grid that is in effect.
scaleX : Number
UIComponent
Number that specifies the horizontal scaling factor.
scaleY : Number
UIComponent
Number that specifies the vertical scaling percentage.
screen : Rectangle UIComponent
Returns an object that contains the size and position of the
base drawing surface for this object.
scrollRect : Rectangle
DisplayObject
The scroll rectangle bounds of the display object.
scrollTipFunction : Function
A function that computes the string to be displayed as the ScrollControlBase
ScrollTip.
selectable : Boolean
A flag that indicates whether the list shows selected items ListBase
as selected.
selectedIndex : int
ListBase
The index in the data provider of the selected item.
selectedIndices : Array
An array of indices in the data provider of the selected ListBase
items.
selectedItem : Object
ListBase
A reference to the selected item in the data provider.
selectedItems : Array
An array of references to the selected items in the data ListBase
provider.
showDataTips : Boolean
A flag that indicates whether dataTips are displayed for text ListBase
in the rows.
showRoot : Boolean
Tree
Sets the visibility of the root item.
showScrollTips : Boolean = false
A flag that indicates whether a tooltip should appear near ScrollControlBase
the scroll thumb when it is being dragged.
soundTransform : SoundTransform
Sprite
Controls sound within this sprite.
stage : Stage
DisplayObject
The Stage of the display object.
states : Array
UIComponent
The view states that are defined for this component.
styleDeclaration : CSSStyleDeclaration
UIComponent
Storage for the inline inheriting styles on this object.
styleName : Object
UIComponent
The class style used by this component.
systemManager : ISystemManager
UIComponent
Returns the SystemManager object used by this component.
tabChildren : Boolean DisplayObjectContainer
Determines whether the children of the object are tab
enabled.
tabEnabled : Boolean
InteractiveObject
Specifies whether this object is in the tab order.
tabIndex : int
InteractiveObject
Specifies the tab ordering of objects in a SWF file.
textSnapshot : TextSnapshot
Returns a TextSnapshot object for this DisplayObjectContainer
DisplayObjectContainer instance.
toolTip : String
UIComponent
Text to display in the ToolTip.
transform : Transform
An object with properties pertaining to a display object's DisplayObject
matrix, color transform, and pixel bounds.
transitions : Array
An Array of Transition objects, where each Transition
UIComponent
object defines a set of effects to play when a view state
change occurs.
tweeningProperties : Array
Array of properties that are currently being tweened on this UIComponent
object.
uid : String
UIComponent
A unique identifier for the object.
updateCompletePendingFlag : Boolean
A flag that determines if an object has been through all
UIComponent
three phases of layout validation (provided that any were
required).
useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand
Sprite
(hand cursor) appears when the mouse rolls over a sprite in
which the buttonMode property is set to true.
validationSubField : String
Used by a validator to associate a subfield with this UIComponent
component.
value : Object
The selected item, or the data or label field of the selected ListBase
item.
variableRowHeight : Boolean
A flag that indicates whether the individual rows can have ListBase
different height.
verticalScrollPolicy : String ScrollControlBase
A property that indicates whether the vertical scroll bar is
always on, always off, or automatically changes based on
the parameters passed to the setScrollBarProperties()
method.
verticalScrollPosition : Number
ScrollControlBase
The offset into the content from the top edge.
viewMetrics : EdgeMetrics
An EdgeMetrics object taking into account the scroll bars, ScrollControlBase
if visible.
visible : Boolean
UIComponent
Controls the visibility of this UIComponent.
width : Number
Number that specifies the width of the component, in UIComponent
pixels, in the parent's coordinates.
wordWrap : Boolean
A flag that indicates whether text in the row should be word ListBase
wrapped.
x : Number
Number that specifies the component's horizontal position, UIComponent
in pixels, within its parent container.
y : Number
Number that specifies the component's vertical position, in UIComponent
pixels, within its parent container.
Protected Properties
Hide Inherited Protected Properties
Show Inherited Protected Properties
Property Defined by
anchorBookmark : CursorBookmark
ListBase
A bookmark to the item that is the anchor.
anchorIndex : int = -1
The offset of the item in the data provider that is the selection ListBase
anchor point.
border : IFlexDisplayObject
ScrollControlBase
The border object.
caretBookmark : CursorBookmark
ListBase
A bookmark to the item under the caret.
caretIndex : int = -1
The offset of the item in the data provider that is the selection ListBase
caret point.
caretIndicator : Sprite
The DisplayObject that contains the graphics that indicate which ListBase
renderer is the caret.
caretItemRenderer : IListItemRenderer
ListBase
The renderer for the item under the caret.
caretUID : String
ListBase
The UID of the item under the caret.
collection : ICollectionView
ListBase
An ICollectionView that represents the data provider.
defaultColumnCount : int = 4
ListBase
The default number of columns to display.
defaultRowCount : int = 4
ListBase
The default number of rows to display.
dragImage : IUIComponent
Gets an instance of a class that displays the visuals during a drag ListBase
and drop operation.
dragImageOffsets : Point
ListBase
Gets the offset of the drag image for drag and drop.
explicitColumnCount : int = -1
The column count requested by explicitly setting the ListBase
columnCount property.
explicitColumnWidth : Number
The column width requested by explicitly setting the ListBase
columnWidth.
explicitRowCount : int = -1
ListBase
The row count requested by explicitly setting rowCount.
explicitRowHeight : Number
ListBase
The row height requested by explicitly setting rowHeight.
freeItemRenderers : Array
ListBase
A stack of unused item renderers.
highlightIndicator : Sprite
The DisplayObject that contains the graphics that indicates which ListBase
renderer is highlighted.
highlightItemRenderer : IListItemRenderer
ListBase
The renderer that is currently rolled over or under the caret.
highlightUID : String
ListBase
The UID of the item that is current rolled over or under the caret.
horizontalScrollBar : ScrollBar
ScrollControlBase
The horizontal scroll bar.
itemsNeedMeasurement : Boolean = true
A flag that indicates whether the columnWidth and rowHeight ListBase
properties need to be calculated.
itemsSizeChanged : Boolean = false ListBase
A flag that indicates that the size of the renderers may have
changed.
iterator : IViewCursor
The main IViewCursor used to fetch items from the data provider ListBase
and pass the items to the renderers.
iteratorValid : Boolean = true
A flag that indicates that a page fault as occurred and that the
ListBase
iterator's position is not valid (not positioned at the topmost item
being displayed).
keySelectionPending : Boolean = false
A flag that indicates if keyboard selection was interrupted by a ListBase
page fault.
lastDropIndex : int
The most recently calculated index where the drag item should be ListBase
added to the drop target.
lastSeekPending : ListBaseSeekPending
ListBase
The most recent seek that caused a page fault.
listContent : ListBaseContentHolder
An internal display object that parents all of the item renderers,
ListBase
selection and highlighting indicators and other supporting
graphics.
listItems : Array
An Array of Arrays that contains the itemRenderer instances that ListBase
render each data provider item.
maskShape : Shape
ScrollControlBase
The mask.
rendererChanged : Boolean = false
ListBase
A flag that indicates that the renderer changed.
rowInfo : Array
An array of ListRowInfo objects that cache row heights and other ListBase
tracking information for the rows in listItems.
rowMap : Object
A hash map of item renderers to their respective ListRowInfo ListBase
object.
scrollAreaChanged : Boolean
A flag that the scrolling area changed due to the appearance or ScrollControlBase
disappearance of scrollbars.
selectedData : Object
A hash table of ListBaseSelectionData objects that track which ListBase
items are currently selected.
selectionIndicators : Object
ListBase
A hash table of selection indicators.
selectionLayer : Sprite
The layer in listContent where all selection and highlight ListBase
indicators are drawn.
selectionTweens : Object
ListBase
A hash table of selection tweens.
showCaret : Boolean
ListBase
A flag that indicates whether to show caret.
unscaledHeight : Number
A convenience method for determining the unscaled height of the
component All of a component's drawing and child layout should UIComponent
be done within a bounding rectangle of this height, which is also
passed as an argument to updateDisplayList().
unscaledWidth : Number
A convenience method for determining the unscaled width of the
component All of a component's drawing and child layout should UIComponent
be done within a bounding rectangle of this width, which is also
passed as an argument to updateDisplayList().
verticalScrollBar : ScrollBar
ScrollControlBase
The vertical scroll bar.
visibleData : Object
ListBase
A hash table of data provider item renderers currently in view.
wordWrapChanged : Boolean = false
A flag that indicates whether the value of the wordWrap property ListBase
has changed since the last time the display list was updated.
Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods
Method Defined by
Tree()
Tree
Constructor.
addChild(child:DisplayObject):DisplayObject
DisplayObjectCont
Adds a child DisplayObject instance to this
ainer
DisplayObjectContainer instance.
addChildAt(child:DisplayObject, index:int):DisplayObject
DisplayObjectCont
Adds a child DisplayObject instance to this
ainer
DisplayObjectContainer instance.
addEventListener(type:String, listener:Function,
useCapture:Boolean = false, priority:int = 0,
useWeakReference:Boolean = false):void EventDispatcher
Registers an event listener object with an EventDispatcher
object so that the listener receives notification of an event.
areInaccessibleObjectsUnderPoint(point:Point):Boolean DisplayObjectCont
Indicates whether the security restrictions would cause any
display objects to be omitted from the list returned by calling the
ainer
DisplayObjectContainer.getObjectsUnderPoint() method
with the specified point point.
calculateDropIndex(event:DragEvent = null):int
Returns the index where the dropped items should be added to ListBase
the drop target.
callLater(method:Function, args:Array = null):void
UIComponent
Queues a function to be called later.
clearStyle(styleProp:String):void
UIComponent
Deletes a style property from this component instance.
contains(child:DisplayObject):Boolean
DisplayObjectCont
Determines whether the specified display object is a child of the
ainer
DisplayObjectContainer instance or the instance itself.
contentToGlobal(point:Point):Point
Converts a Point object from content coordinates to global UIComponent
coordinates.
contentToLocal(point:Point):Point
UIComponent
Converts a Point object from content to local coordinates.
createItemEditor(colIndex:int, rowIndex:int):void
Creates the item editor for the item renderer at the
List
editedItemPosition using the editor specified by the
itemEditor property.
createReferenceOnParentDocument(parentDocument:IFlexDispl
ayObject):void
UIComponent
Creates an id reference to this IUIComponent object on its
parent document object.
deleteReferenceOnParentDocument(parentDocument:IFlexDispl
ayObject):void
UIComponent
Deletes the id reference to this IUIComponent object on its
parent document object.
destroyItemEditor():void
List
Closes an item editor that is currently open on an item.
determineTextFormatFromStyles():UITextFormat
Returns a UITextFormat object corresponding to the text styles UIComponent
for this UIComponent.
dispatchEvent(event:Event):Boolean
EventDispatcher
Dispatches an event into the event flow.
drawFocus(focused:Boolean):void
UIComponent
Shows or hides the focus indicator around this component.
drawRoundRect(x:Number, y:Number, w:Number, h:Number, UIComponent
r:Object = null, c:Object = null, alpha:Object = null, rot:Object =
null, gradient:String = null, ratios:Array = null, hole:Object =
null):void
Programatically draws a rectangle into this skin's Graphics
object.
effectFinished(effectInst:EffectInstance):void
Called by the effect instance when it stops playing on the UIComponent
component.
effectStarted(effectInst:EffectInstance):void
Called by the effect instance when it starts playing on the UIComponent
component.
endEffectsStarted():void
UIComponent
Ends all currently playing effects on the component.
executeBindings(recurse:Boolean = false):void
UIComponent
Executes the data bindings into this UIComponent object.
expandChildrenOf(item:Object, open:Boolean):void
Tree
Opens or closes all the tree items below the specified item.
expandItem(item:Object, open:Boolean, animate:Boolean =
false, dispatchEvent:Boolean = false, cause:Event = null):void Tree
Opens or closes a branch item.
findString(str:String):Boolean
Finds an item in the list based on a string and moves the ListBase
selection to it.
finishPrint(obj:Object, target:IFlexDisplayObject):void
UIComponent
Called after printing is complete.
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
Returns a rectangle that defines the area of the display object
DisplayObject
relative to the coordinate system of the
targetCoordinateSpace object.
getChildAt(index:int):DisplayObject
DisplayObjectCont
Returns the child display object instance that exists at the
ainer
specified index.
getChildByName(name:String):DisplayObject
DisplayObjectCont
Returns the child display object that exists with the specified
ainer
name.
getChildIndex(child:DisplayObject):int DisplayObjectCont
Returns the index position of a child DisplayObject instance. ainer
getClassStyleDeclarations():Array
UIComponent
Finds the type selectors for this UIComponent instance.
getExplicitOrMeasuredHeight():Number
A convenience method for determining whether to use the UIComponent
explicit or measured height
getExplicitOrMeasuredWidth():Number
A convenience method for determining whether to use the UIComponent
explicit or measured width
getFocus():InteractiveObject
UIComponent
Gets the object that currently has focus.
getObjectsUnderPoint(point:Point):Array
Returns an array of objects that lie under the specified point and DisplayObjectCont
are children (or grandchildren, and so on) of this ainer
DisplayObjectContainer instance.
getParentItem(item:Object):*
Tree
Returns the known parent of a child item.
getRect(targetCoordinateSpace:DisplayObject):Rectangle
Returns a rectangle that defines the boundary of the display
object, based on the coordinate system defined by the DisplayObject
targetCoordinateSpace parameter, excluding any strokes on
shapes.
getRepeaterItem(whichRepeater:int = -1):Object
Returns the item in the dataProvider that was used by the
UIComponent
specified Repeater to produce this Repeater, or null if this
Repeater isn't repeated.
getStyle(styleProp:String):*
Gets a style property that has been set anywhere in this UIComponent
component's style lookup chain.
globalToContent(point:Point):Point
UIComponent
Converts a Point object from global to content coordinates.
globalToLocal(point:Point):Point
Converts the point object from the Stage (global) coordinates to DisplayObject
the display object's (local) coordinates.
hasEventListener(type:String):Boolean
Checks whether the EventDispatcher object has any listeners EventDispatcher
registered for a specific type of event.
hasOwnProperty(name:String):Boolean
Object
Indicates whether an object has a specified property defined.
hideDropFeedback(event:DragEvent):void
Hides the drop indicator under the mouse pointer that indicates ListBase
that a drag and drop operation is allowed.
hitTestObject(obj:DisplayObject):Boolean
Evaluates the display object to see if it overlaps or intersects DisplayObject
with the obj display object.
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = DisplayObject
false):Boolean
Evaluates the display object to see if it overlaps or intersects
with the point specified by the x and y parameters.
horizontalGradientMatrix(x:Number, y:Number, width:Number,
height:Number):Matrix
Returns a box Matrix which can be passed to the UIComponent
drawRoundRect() method as the rot parameter when drawing a
horizontal gradient.
indexToItemRenderer(index:int):IListItemRenderer
Get an item renderer for the index of an item in the data ListBase
provider, if one exists.
indicesToIndex(rowIndex:int, colIndex:int):int
Computes the offset into the data provider of the item at ListBase
colIndex, rowIndex.
initialize():void
UIComponent
Initializes the internal structure of this component.
initializeRepeaterArrays(parent:IRepeaterClient):void
Initializes various properties which keep track of repeated UIComponent
instances of this component.
invalidateDisplayList():void
Marks a component so that its updateDisplayList() method UIComponent
gets called during a later screen update.
invalidateList():void
ListBase
Refresh all rows on next update.
invalidateProperties():void
Marks a component so that its commitProperties() method UIComponent
gets called during a later screen update.
invalidateSize():void
Marks a component so that its measure() method gets called UIComponent
during a later screen update.
isItemHighlighted(data:Object):Boolean
Determines if the item renderer for a data provider item is
ListBase
highlighted (is rolled over via the mouse or or under the caret
via keyboard navigation).
isItemOpen(item:Object):Boolean
Returns true if the specified item branch is open (is showing its Tree
children).
isItemSelected(data:Object):Boolean
Determines if the item renderer for a data provider item is ListBase
selected.
isItemVisible(item:Object):Boolean
ListBase
Determines if an item is being displayed by a renderer.
isPrototypeOf(theClass:Object):Boolean Object
Indicates whether an instance of the Object class is in the
prototype chain of the object specified as the parameter.
itemRendererContains(renderer:IListItemRenderer,
object:DisplayObject):Boolean
ListBase
Determines whether a renderer contains (or owns) a display
object.
itemRendererToIndex(itemRenderer:IListItemRenderer):int
Returns the index of the item in the data provider of the item ListBase
being rendered by this item renderer.
itemToDataTip(data:Object):String
Returns the dataTip string the renderer would display for the
ListBase
given data object based on the dataTipField and dataTipFunction
properties.
itemToIcon(data:Object):Class
Returns the class for an icon, if any, for a data item, based on the ListBase
iconField and iconFunction properties.
itemToItemRenderer(item:Object):IListItemRenderer
Returns the item renderer for a given item in the data provider, if ListBase
there is one.
itemToLabel(data:Object):String
Returns the string the renderer would display for the given data ListBase
object based on the labelField and labelFunction properties.
localToContent(point:Point):Point
UIComponent
Converts a Point object from local to content coordinates.
localToGlobal(point:Point):Point
Converts the point object from the display object's (local) DisplayObject
coordinates to the Stage (global) coordinates.
measureHeightOfItems(index:int = -1, count:int = 0):Number
Measures a set of items from the data provider using the current ListBase
item renderer and returns the sum of the heights of those items.
measureHTMLText(htmlText:String):TextLineMetrics
Measures the specified HTML text, which may contain HTML
tags such as <font> and <b>, assuming that it is displayed in a UIComponent
single-line UITextField using a UITextFormat determined by the
styles of this UIComponent.
measureText(text:String):TextLineMetrics
Measures the specified text, assuming that it is displayed in a
UIComponent
single-line UITextField using a UITextFormat determined by the
styles of this UIComponent.
measureWidthOfItems(index:int = -1, count:int = 0):Number
Measures a set of items from the data provider using the current ListBase
item renderer and returns the maximum width found.
move(x:Number, y:Number):void
UIComponent
Moves the component to a specified position within its parent.
notifyStyleChangeInChildren(styleProp:String,
recursive:Boolean):void UIComponent
Propagate style changes to the children.
owns(child:DisplayObject):Boolean
Returns true if the chain of owner properties points from child UIComponent
to this UIComponent.
parentChanged(p:DisplayObjectContainer):void
Called by Flex when a UIComponent object is added to or UIComponent
removed from a parent.
prepareToPrint(target:IFlexDisplayObject):Object
UIComponent
Prepares an IFlexDisplayObject for printing.
propertyIsEnumerable(name:String):Boolean
Indicates whether the specified property exists and is Object
enumerable.
regenerateStyleCache(recursive:Boolean):void
Builds or rebuilds the CSS style cache for this component and, if
UIComponent
the recursive parameter is true, for all descendants of this
component as well.
registerEffects(effects:Array):void
For each effect event, register the EffectManager as one of the UIComponent
event listeners.
removeChild(child:DisplayObject):DisplayObject
DisplayObjectCont
Removes the specified child DisplayObject instance from the
ainer
child list of the DisplayObjectContainer instance.
removeChildAt(index:int):DisplayObject
DisplayObjectCont
Removes a child DisplayObject from the specified index
ainer
position in the child list of the DisplayObjectContainer.
removeEventListener(type:String, listener:Function,
useCapture:Boolean = false):void EventDispatcher
Removes a listener from the EventDispatcher object.
resumeBackgroundProcessing():void
[static] Resumes the background processing of methods queued
UIComponent
by callLater(), after a call to
suspendBackgroundProcessing().
scrollToIndex(index:int):Boolean
ListBase
Ensures that the data provider item at the given index is visible.
setActualSize(w:Number, h:Number):void
UIComponent
Sizes the object.
setChildIndex(child:DisplayObject, index:int):void DisplayObjectCont
Changes the position of an existing child in the display object
ainer
container.
setCurrentState(stateName:String, playTransition:Boolean =
true):void UIComponent
Set the current state.
setFocus():void
UIComponent
Sets the focus to this component.
setItemIcon(item:Object, iconID:Class, iconID2:Class):void
Tree
Sets the associated icon for the item.
setPropertyIsEnumerable(name:String, isEnum:Boolean =
true):void Object
Sets the availability of a dynamic property for loop operations.
setStyle(styleProp:String, newValue:*):void
UIComponent
Sets a style property on this component instance.
setVisible(value:Boolean, noEvent:Boolean = false):void
UIComponent
Called when the visible property changes.
showDropFeedback(event:DragEvent):void
Displays a drop indicator under the mouse pointer to indicate
ListBase
that a drag and drop operation is allowed and where the items
will be dropped.
startDrag(lockCenter:Boolean = false, bounds:Rectangle =
null):void Sprite
Lets the user drag the specified sprite.
stopDrag():void
Sprite
Ends the startDrag() method.
styleChanged(styleProp:String):void
UIComponent
Detects changes to style properties.
stylesInitialized():void
Flex calls the stylesInitialized() method when the styles UIComponent
for a component are first initialized.
suspendBackgroundProcessing():void
[static] Blocks the background processing of methods queued by UIComponent
callLater(), until resumeBackgroundProcessing() is called.
swapChildren(child1:DisplayObject, child2:DisplayObject):void
DisplayObjectCont
Swaps the z-order (front-to-back order) of the two specified
ainer
child objects.
swapChildrenAt(index1:int, index2:int):void
DisplayObjectCont
Swaps the z-order (front-to-back order) of the child objects at
ainer
the two specified index positions in the child list.
toString():String FlexSprite
Returns a string indicating the location of this object within the
hierarchy of DisplayObjects in the Application.
validateDisplayList():void
Validates the position and size of children and draws other UIComponent
visuals.
validateNow():void
Validate and update the properties and layout of this object and UIComponent
redraw it, if necessary.
validateProperties():void
Used by layout logic to validate the properties of a component UIComponent
by calling the commitProperties() method.
validateSize(recursive:Boolean = false):void
Validates the measured size of the component If the
LayoutManager.invalidateSize() method is called with this UIComponent
ILayoutManagerClient, then the validateSize() method is
called when it's time to do measurements.
validationResultHandler(event:ValidationResultEvent):void
Handles both the valid and invalid events from a validator UIComponent
assigned to this component.
valueOf():Object
Object
Returns the primitive value of the specified object.
verticalGradientMatrix(x:Number, y:Number, width:Number,
height:Number):Matrix
UIComponent
Returns a box Matrix which can be passed to drawRoundRect()
as the rot parameter when drawing a vertical gradient.
willTrigger(type:String):Boolean
Checks whether an event listener is registered with this
EventDispatcher
EventDispatcher object or any of its ancestors for the specified
event type.
Protected Methods
Hide Inherited Protected Methods
Show Inherited Protected Methods
Method Defined by
addDragData(ds:Object):void
Adds the selected items to the DragSource object as part of a ListBase
drag-and-drop operation.
addToFreeItemRenderers(item:IListItemRenderer):void
Adds a renderer to the recycled renderer list, making it invisible ListBase
and cleaning up references to it.
adjustFocusRect(obj:DisplayObject = null):void
UIComponent
Adjust the focus rectangle.
applySelectionEffect(indicator:Sprite, uid:String, ListBase
itemRenderer:IListItemRenderer):void
Sets up the effect for applying the selection indicator.
attachOverlay():void
This is an internal method used by the Flex framework to support UIComponent
the Dissolve effect.
calculateDropIndicatorY(rowCount:Number,
rowNum:int):Number
ListBase
Calculates the y position of the drop indicator when performing a
drag-and-drop operation.
childrenCreated():void
UIComponent
Performs any final processing after child objects are created.
clearIndicators():void
ListBase
Removes all selection and highlight and caret indicators.
clearSelected(transition:Boolean = false):void
Clears the set of selected items and removes all graphics depicting ListBase
the selected state of those items.
collectionChangeHandler(event:Event):void
Handles CollectionEvents dispatched from the data provider as ListBase
the data changes.
commitProperties():void
Calculates the column width and row height and number of rows
ListBase
and columns based on whether properties like columnCount
columnWidth, rowHeight and rowCount were explicitly set.
configureScrollBars():void
Configures the ScrollBars based on the number of rows and ListBase
columns and viewable rows and columns.
copySelectedItems(useDataField:Boolean = true):Array
Makes a copy of the selected items in the order they were ListBase
selected.
createBorder():void ScrollControlBas
Creates the border for this component. e
createChildren():void
Create objects that are children of this ListBase, in this case the ListBase
listContent object that will hold all the item renderers.
dragCompleteHandler(event:DragEvent):void
ListBase
Handles DragEvent.DRAG_COMPLETE events.
dragDropHandler(event:DragEvent):void
ListBase
Handles DragEvent.DRAG_DROP events.
dragEnterHandler(event:DragEvent):void
ListBase
Handles DragEvent.DRAG_ENTER events.
dragExitHandler(event:DragEvent):void
ListBase
Handles DragEvent.DRAG_EXIT events.
dragOverHandler(event:DragEvent):void
ListBase
Handles DragEvent.DRAG_OVER events.
dragScroll():void
Interval function that scrolls the list up or down if the mouse goes ListBase
above or below the list.
drawCaretIndicator(indicator:Sprite, x:Number, y:Number,
width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void ListBase
Draws the caret indicator into the given Sprite at the position,
width and height specified using the color specified.
drawHighlightIndicator(indicator:Sprite, x:Number, y:Number,
width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void ListBase
Draws the highlight indicator into the given Sprite at the position,
width and height specified using the color specified.
drawItem(item:IListItemRenderer, selected:Boolean = false,
highlighted:Boolean = false, caret:Boolean = false,
transition:Boolean = false):void ListBase
Draws the renderer with indicators that it is highlighted, selected,
or the caret.
drawRowBackground(s:Sprite, rowIndex:int, y:Number,
height:Number, color:uint, dataIndex:int):void List
Draws a row background at the position and height specified.
drawRowBackgrounds():void
Draws any alternating row colors, borders and backgrounds for ListBase
the rows.
drawSelectionIndicator(indicator:Sprite, x:Number, y:Number,
width:Number, height:Number, color:uint,
itemRenderer:IListItemRenderer):void ListBase
Draws the selection indicator into the given Sprite at the position,
width and height specified using the color specified.
endEdit(reason:String):Boolean
List
Stops the editing of an item in the data provider.
findKey(eventCode:int):Boolean
Tries to find the next item in the data provider that starts with the ListBase
character in the eventCode parameter.
finishKeySelection():void
Sets selected items based on the caretIndex and anchorIndex ListBase
properties.
focusInHandler(event:FocusEvent):void
UIComponent
The event handler called when a UIComponent object gets focus.
focusOutHandler(event:FocusEvent):void UIComponent
The event handler called when a UIComponent object loses focus.
indexToColumn(index:int):int
ListBase
The column for the data provider item at the given index.
indexToRow(index:int):int
ListBase
The row for the data provider item at the given index.
initializationComplete():void
UIComponent
Finalizes the initialization of this component.
initializeAccessibility():void
UIComponent
Initializes this component's accessibility code.
initListData(item:Object, treeListData:TreeListData):void
Initializes a TreeListData object that is used by the tree item Tree
renderer.
isOurFocus(target:DisplayObject):Boolean
Typically overridden by components containing UITextField UIComponent
objects, where the UITextField object gets focus.
itemRendererToIndices(item:IListItemRenderer):Point
Returns a Point containing the columnIndex and rowIndex of an ListBase
item renderer.
itemToUID(data:Object):String
ListBase
Determines the UID for a data provider item.
keyDownHandler(event:KeyboardEvent):void
UIComponent
The event handler called for a keyDown event.
keyUpHandler(event:KeyboardEvent):void
UIComponent
The event handler called for a keyUp event.
layoutChrome(unscaledWidth:Number,
unscaledHeight:Number):void ScrollControlBas
Responds to size changes by setting the positions and sizes of this e
control's borders.
layoutEditor(x:int, y:int, w:int, h:int):void
Positions the item editor instance at the suggested position with List
the suggested dimensions.
makeListData(data:Object, uid:String, rowNum:int):BaseListData
Creates a new ListData instance and populates the fields based on List
the input data provider item.
makeRowsAndColumns(left:Number, top:Number, right:Number,
bottom:Number, firstColumn:int, firstRow:int, byCount:Boolean
= false, rowsNeeded:uint = 0):Point ListBase
Make enough rows and columns to fill the area described by left,
top, right, bottom.
measure():void ListBase
Calculates the measured width and height of the component based
on the rowCount, columnCount, rowHeight and columnWidth
properties.
mouseClickHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_CLICK events from any mouse ListBase
targets contained in the list including the renderers.
mouseDoubleClickHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_DOUBLE_CLICK events from any ListBase
mouse targets contained in the list including the renderers.
mouseDownHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_DOWN events from any mouse targets ListBase
contained in the list including the renderers.
mouseEventToItemRenderer(event:MouseEvent):IListItemRender
er ListBase
Determines which item renderer is under the mouse.
mouseMoveHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_MOVE events from any mouse targets ListBase
contained in the list including the renderers.
mouseOutHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_OUT events from any mouse targets ListBase
contained in the list including the renderers.
mouseOverHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_OVER events from any mouse targets ListBase
contained in the list, including the renderers.
mouseUpHandler(event:MouseEvent):void
Handles MouseEvent.MOUSE_DOWN events from any mouse targets ListBase
contained in the list including the renderers.
mouseWheelHandler(event:MouseEvent):void
ListBase
Handles mouseWheel events by changing scroll positions.
moveSelectionHorizontally(code:uint, shiftKey:Boolean,
ctrlKey:Boolean):void
Moves the selection in a horizontal direction in response to the ListBase
user selecting items using the left-arrow or right-arrow keys and
modifiers such as the Shift and Ctrl keys.
moveSelectionVertically(code:uint, shiftKey:Boolean,
ctrlKey:Boolean):void
Moves the selection in a vertical direction in response to the user ListBase
selecting items using the up-arrow or down-arrow Keys and
modifiers such as the Shift and Ctrl keys.
removeIndicators(uid:String):void
Cleans up selection highlights and other associated graphics for a ListBase
given item in the data provider.
scrollHandler(event:Event):void ScrollControlBas
Default event handler for the scroll event. e
scrollHorizontally(pos:int, deltaPos:int, scrollUp:Boolean):void
ListBase
Adjusts the renderers in response to a change in scroll position.
scrollPositionToIndex(horizontalScrollPosition:int,
verticalScrollPosition:int):int
ListBase
Returns the data provider index for the item at the first visible row
and column for the given scroll positions.
scrollVertically(pos:int, deltaPos:int, scrollUp:Boolean):void
ListBase
Adjusts the renderers in response to a change in scroll position.
seekPendingFailureHandler(data:Object,
info:ListBaseSeekPending):void ListBase
The default failure handler when a seek fails due to a page fault.
seekPendingResultHandler(data:Object,
info:ListBaseSeekPending):void ListBase
The default result handler when a seek fails due to a page fault.
selectItem(item:IListItemRenderer, shiftKey:Boolean,
ctrlKey:Boolean, transition:Boolean = true):Boolean
Updates the set of selected items given that the item renderer ListBase
provided was clicked by the mouse and the keyboard modifiers
are in the given state.
setRowCount(v:int):void
Sets the rowCount property without causing invalidation or
ListBase
setting the explicitRowCount property, which permanently locks
in the number of rows.
setRowHeight(v:Number):void
Sets rowHeight without causing invalidation or setting of
ListBase
explicitRowHeight which permanently locks in the height of
the rows
setScrollBarProperties(totalColumns:int, visibleColumns:int,
totalRows:int, visibleRows:int):void ScrollControlBas
Causes the ScrollControlBase to show or hide scrollbars based on e
the parameters passed in.
updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
ListBase
Adds or removes item renderers if the number of displayable
items changed.
updateList():void
ListBase
Refreshes all rows now.
Events
Hide Inherited Events
Show Inherited Events
Event Summary Defined by
Dispatched when Flash Player gains
activate operating system focus and becomes DisplayObject
active.
Dispatched when the component is added
to a container as a content child by using
add UIComponent
the addChild() or addChildAt()
method.
Dispatched when a display object is added
added DisplayObject
to the display list.
Dispatched when the user selects a tree
change Tree
item.
Dispatched when the selectedIndex or
change selectedItem property changes as a ListBase
result of user interaction.
Dispatched when a user presses and
releases the main button of the user's
click InteractiveObject
pointing device over the same
InteractiveObject.
Dispatched when the component has
finished its construction, property
creationComplete UIComponent
processing, measuring, layout, and
drawing.
Dispatched after the view state has
currentStateChange UIComponent
changed.
Dispatched after the currentState
currentStateChanging property changes, but before the view state UIComponent
changes.
Dispatched when the data property
dataChange ListBase
changes.
Dispatched when Flash Player loses
deactivate operating system focus and is becoming DisplayObject
inactive.
Dispatched when a user presses and
releases the main button of a pointing
doubleClick device twice in rapid succession over the InteractiveObject
same InteractiveObject when that object's
doubleClickEnabled flag is set to true.
dragComplete Dispatched by the drag initiator (the UIComponent
component that is the source of the data
being dragged) when the drag operation
completes, either when you drop the
dragged data onto a drop target or when
you end the drag-and-drop operation
without performing a drop.
Dispatched by the drop target when the
dragDrop UIComponent
user releases the mouse over it.
Dispatched by a component when the user
dragEnter moves the mouse over the component UIComponent
during a drag operation.
Dispatched by the component when the
dragExit user drags outside the component, but does UIComponent
not drop the data onto the target.
Dispatched by a component when the user
dragOver moves the mouse while over the UIComponent
component during a drag operation.
effectEnd Dispatched after an effect ends. UIComponent
effectStart Dispatched just before an effect starts. UIComponent
Dispatched when the playhead is entering
enterFrame DisplayObject
a new frame.
Dispatched after the component has
enterState UIComponent
returned to the root view state.
Dispatched before the component exits
exitState UIComponent
from the root view state.
Dispatched after a display object gains
focusIn InteractiveObject
focus.
Dispatched after a display object loses
focusOut InteractiveObject
focus.
Dispatched when an object's state changes
hide UIComponent
from visible to invisible.
Dispatched when the component has
initialize finished its construction and has all UIComponent
initialization properties set.
Dispatched when a component is
invalid monitored by a Validator and the UIComponent
validation failed.
Dispatched when the user clicks on an
itemClick ListBase
item in the control.
Dispatched when a branch is closed or
itemClose Tree
collapsed.
Dispatched when the user double-clicks on
itemDoubleClick ListBase
an item in the control.
itemEditBegin Dispatched when the List
editedItemPosition property is set and
the item can be edited.
Dispatched when the user releases the
mouse button while over an item, tabs to
itemEditBeginning List
the List or within the List, or in any other
way attempts to edit an item.
Dispatched when an item editing session is
itemEditEnd List
ending for any reason.
Dispatched when an item renderer gets
focus, which can occur if the user clicks
itemFocusIn List
on an item in the List control or navigates
to the item using a keyboard.
Dispatched when an item renderer loses
the focus, which can occur if the user
clicks another item in the List control or
itemFocusOut List
outside the list, or uses the keyboard to
navigate to another item in the List control
or outside the List control.
Dispatched when a branch is opened or
itemOpen Tree
expanded.
Dispatched when a branch open or close is
itemOpening Tree
initiated.
Dispatched when the user rolls the mouse
itemRollOut ListBase
pointer out of an item in the control.
Dispatched when the user rolls the mouse
itemRollOver ListBase
pointer over an item in the control.
keyDown Dispatched when the user presses a key. InteractiveObject
Dispatched when the user attempts to
keyFocusChange change focus by using keyboard InteractiveObject
navigation.
keyUp Dispatched when the user releases a key. InteractiveObject
Dispatched when a user presses the
pointing device button over an
mouseDown InteractiveObject
InteractiveObject instance in the Flash
Player window.
Dispatched from a component opened
mouseDownOutside using the PopUpManager when the user UIComponent
clicks outside it.
Dispatched when the user attempts to
mouseFocusChange InteractiveObject
change focus by using a pointer device.
mouseMove Dispatched when a user moves the InteractiveObject
pointing device while it is over an
InteractiveObject.
Dispatched when the user moves a
mouseOut pointing device away from an InteractiveObject
InteractiveObject instance.
Dispatched when the user moves a
mouseOver pointing device over an InteractiveObject InteractiveObject
instance in the Flash Player window.
Dispatched when a user releases the
pointing device button over an
mouseUp InteractiveObject
InteractiveObject instance in the Flash
Player window.
Dispatched when a mouse wheel is spun
mouseWheel over an InteractiveObject instance in the InteractiveObject
Flash Player window.
Dispatched from a component opened
mouseWheelOutside using the PopUpManager when the user UIComponent
scrolls the mouse wheel outside it.
move Dispatched when the object has moved. UIComponent
Dispatched at the beginning of the
preinitialize UIComponent
component initialization sequence.
Dispatched when the component is
removed from a container as a content
remove UIComponent
child by using the removeChild() or
removeChildAt() method.
Dispatched when a display object is about
removed DisplayObject
to be removed from the display list.
Dispatched when the display list is about
render DisplayObject
to be updated and rendered.
Dispatched when the component is
resize UIComponent
resized.
Dispatched when the user moves a
rollOut pointing device away from an InteractiveObject
InteractiveObject instance.
Dispatched when the user moves a
rollOver pointing device over an InteractiveObject InteractiveObject
instance.
scroll Dispatched when the content is scrolled. ScrollControlBase
Dispatched when an object's state changes
show UIComponent
from invisible to visible.
tabChildrenChange Dispatched when the value of the object's InteractiveObject
tabChildren flag changes.
Dispatched when the object's tabEnabled
tabEnabledChange InteractiveObject
flag changes.
Dispatched when the value of the object's
tabIndexChange InteractiveObject
tabIndex property changes.
Dispatched by the component when it is
toolTipCreate UIComponent
time to create a ToolTip.
Dispatched by the component when its
toolTipEnd ToolTip has been hidden and will be UIComponent
discarded soon.
Dispatched by the component when its
toolTipHide UIComponent
ToolTip is about to be hidden.
Dispatched by the component when its
toolTipShow UIComponent
ToolTip is about to be shown.
Dispatched by the component when its
toolTipShown UIComponent
ToolTip has been shown.
Dispatched by a component whose
toolTipStart toolTip property is set, as soon as the UIComponent
user moves the mouse over it.
Dispatched when an object has had its
commitProperties(), measure(), and
updateComplete UIComponent
updateDisplayList() methods called (if
needed).
Dispatched when a component is
valid monitored by a Validator and the UIComponent
validation succeeded.
Dispatched when values are changed
valueCommit UIComponent
programmatically or by user interaction.
Styles
Hide Inherited Styles
Show Inherited Styles
Style Description Defined by
Type: Array Format: Color CSS
Inheritance: yes
Colors for rows in an alternating pattern.
alternatingItemColors Value can be an Array of two of more Tree
colors. Used only if the backgroundColor
property is not specified. The default value
is undefined.
backgroundAlpha Type: Number CSS Inheritance: no ScrollControl
Alpha level of the color defined by the Base
backgroundColor property, of the image
or SWF file defined by the
backgroundImage style.
Type: uint Format: Color CSS
ScrollControl
backgroundColor Inheritance: no
Base
Background color of a component.
Type: uint Format: Color CSS
Inheritance: yes
Background color of the component when
it is disabled. The global default value is
backgroundDisabledCol undefined. The default value for List
Tree
or controls is 0xDDDDDD (light gray). If a
Container is disabled, the background is
dimmed, and the degree of dimming is
controlled by the disabledOverlayAlpha
style.
Type: Object Format: File CSS
ScrollControl
backgroundImage Inheritance: no
Base
Background image of a component.
Type: String CSS Inheritance: no
Scales the image specified by ScrollControl
backgroundSize
backgroundImage to different percentage Base
sizes.
Type: uint Format: Color CSS
ScrollControl
borderColor Inheritance: no
Base
Color of the border.
Type: String CSS Inheritance: no ScrollControl
borderSides
Bounding box sides. Base
Type: Class CSS Inheritance: no ScrollControl
borderSkin
The border skin of the component. Base
Type: String CSS Inheritance: no ScrollControl
borderStyle
Bounding box style. Base
Type: Number Format: Length CSS
ScrollControl
borderThickness Inheritance: no
Base
Bounding box thickness.
Type: Number Format: Length CSS
Inheritance: no
bottom The vertical distance in pixels from the UIComponent
lower edge of the component to the lower
edge of its parent container.
color Type: uint Format: Color CSS ScrollControl
Inheritance: yes Base
Color of text in the component, including
the component label.
Type: Number Format: Length CSS
ScrollControl
cornerRadius Inheritance: no
Base
Radius of component corners.
Type: Class Format: EmbeddedFile CSS
Inheritance: no
Specifies the default icon for a leaf item.
In MXML, you can use the following
defaultLeafIcon Tree
syntax to set this property:
defaultLeafIcon="@Embed(source='c.
jpg');" The default value is
TreeNodeIcon in assets.swf.
Type: Array Format: Color CSS
Inheritance: yes
depthColors Array of colors used in the Tree control, in Tree
descending order. The default value is
undefined.
Type: uint Format: Color CSS
Inheritance: yes ScrollControl
disabledColor
Color of text in the component if it is Base
disabled.
Type: Class Format: EmbeddedFile CSS
Inheritance: no
Specifies the icon that is displayed next to
disclosureClosedIcon a parent item that is closed so that its Tree
children are not displayed (the subtree is
collapsed). The default value is
TreeDisclosureClosed in assets.swf.
Type: Class Format: EmbeddedFile CSS
Inheritance: no
Specifies the icon that is displayed next to
disclosureOpenIcon Tree
a parent item that is open so that its
children are displayed. The default value is
TreeDisclosureOpen in assets.swf.
Type: Class CSS Inheritance: no
dropIndicatorSkin The skin to use to indicate where a ListBase
dragged item can be dropped.
Type: uint Format: Color CSS
ScrollControl
dropShadowColor Inheritance: yes
Base
Color of the drop shadow.
dropShadowEnabled Type: Boolean CSS Inheritance: no ScrollControl
Boolean property that specifies whether Base
the component has a visible drop shadow.
Type: uint Format: Color CSS
Inheritance: yes
errorColor UIComponent
Color of the component highlight when
validation fails..
Type: Number CSS Inheritance: no
focusAlpha Specifies the alpha transparency value of ListBase
the focus skin.
Type: String CSS Inheritance: no
focusBlendMode UIComponent
Blend mode used by the focus rectangle.
Type: String CSS Inheritance: no
focusRoundedCorners Specifies which corners of the focus ListBase
rectangle should be rounded.
Type: Class CSS Inheritance: no
focusSkin UIComponent
Skin used to draw the focus rectangle.
Type: Number Format: Length CSS
Inheritance: no
focusThickness UIComponent
Thickness, in pixels, of the focus rectangle
outline.
Type: Class Format: EmbeddedFile CSS
Inheritance: no
Specifies the folder closed icon for a
branch item of the tree. In MXML, you
folderClosedIcon can use the following syntax to set this Tree
property:
folderClosedIcon="@Embed(source='b
.jpg');" The default value is
TreeFolderClosed in assets.swf.
Type: Class Format: EmbeddedFile CSS
Inheritance: no
Specifies the folder open icon for a branch
item of the tree. In MXML, you can use
folderOpenIcon Tree
the following syntax to set this property:
folderOpenIcon="@Embed(source='a.j
pg');" The default value is
TreeFolderOpen in assets.swf.
Type: String CSS Inheritance: yes
ScrollControl
fontAntiAliasType Sets the antiAliasType property of
Base
internal TextFields.
Type: String CSS Inheritance: yes ScrollControl
fontFamily
Name of the font to use. Base
fontGridFitType Type: String CSS Inheritance: yes ScrollControl
Sets the gridFitType property of internal Base
TextFields that represent text in Flex
controls.
Type: Number CSS Inheritance: yes
Sets the sharpness property of internal ScrollControl
fontSharpness
TextFields that represent text in Flex Base
controls.
Type: Number Format: Length CSS
ScrollControl
fontSize Inheritance: yes
Base
Height of the text, in pixels.
Type: String CSS Inheritance: yes ScrollControl
fontStyle
Determines whether the text is italic font. Base
Type: Number CSS Inheritance: yes
Sets the thickness property of internal ScrollControl
fontThickness
TextFields that represent text in Flex Base
controls.
Type: String CSS Inheritance: yes ScrollControl
fontWeight
Determines whether the text is boldface. Base
Type: Number Format: Length CSS
Inheritance: no
horizontalCenter The horizontal distance in pixels from the UIComponent
center of the component's parent container
to the center of the component.
horizontalScrollBarStyle Type: String CSS Inheritance: no ScrollControl
Name Style name for horizontal scrollbar. Base
Type: Number CSS Inheritance: no
indentation Indentation for each tree level, in pixels. Tree
The default value is 17.
Type: Number Format: Length CSS
Inheritance: no ScrollControl
leading
Additional vertical space between lines of Base
text.
Type: Number Format: Length CSS
Inheritance: no
The horizontal distance in pixels from the
left UIComponent
left edge of the component's parent
container to the left edge of the
component.
Type: Number Format: Time CSS
Inheritance: no
openDuration Tree
Length of an open or close transition, in
milliseconds. The default value is 250.
openEasingFunction Type: Function CSS Inheritance: no Tree
Easing function to control component
tweening.

The default value is undefined.


Type: Number Format: Length CSS
Inheritance: no
paddingBottom The number of pixels between the bottom ListBase
of the row and the bottom of the renderer
in the row.
Type: Number Format: Length CSS
Inheritance: no
Number of pixels between the container's
left border and the left edge of its content
area.

The default value is 0.


paddingLeft Tree
The default value for a Button and
CheckBox control is 3.
The default value for the ComboBox
control is 5.
The default value for the Form container is
16.
The default value for the Tree control is 2.
Type: Number Format: Length CSS
Inheritance: no
Number of pixels between the container's
right border and the right edge of its
content area.

paddingRight The default value is 0. Tree


The default value for a Button and
CheckBox control is 3.
The default value for the ComboBox
control is 5.
The default value for the Form container is
16.
Type: Number Format: Length CSS
Inheritance: no
paddingTop The number of pixels between the top of ListBase
the row and the top of the renderer in the
row.
repeatDelay Type: Number Format: Time CSS ScrollControl
Inheritance: no Base
Number of milliseconds to wait after the
first buttonDown event before repeating
buttonDown events at the value specified
by repeatInterval.
Type: Number Format: Time CSS
Inheritance: no
ScrollControl
repeatInterval Number of milliseconds between
Base
buttonDown events if the user presses and
holds on a button.
Type: Number Format: Length CSS
Inheritance: no
right The horizontal distance in pixels from the UIComponent
right edge of the component to the right
edge of its parent container.
Type: uint Format: Color CSS
Inheritance: yes
rollOverColor Color of the background when the user Tree
rolls over the link. The default value is
undefined.
Type: uint Format: Color CSS
Inheritance: yes
selectionColor Color of the background when the user Tree
selects the link. The default value is
undefined.
Type: uint Format: Color CSS
Inheritance: yes
selectionDisabledColor Tree
Specifies the disabled color of a list item.
The default value is 0xDDDDDD.
Type: Number Format: Time CSS
selectionDuration Inheritance: no ListBase
The duration of the selection effect.
Type: Function CSS Inheritance: no
Reference to an easingFunction function
used for controlling programmatic
selectionEasingFunction Tree
tweening.

The default value is undefined.


Type: String CSS Inheritance: no ScrollControl
shadowDirection
Direction of the drop shadow. Base
Type: Number Format: Length CSS
ScrollControl
shadowDistance Inheritance: no
Base
Distance of the drop shadow.
Type: String CSS Inheritance: yes ScrollControl
textAlign
Alignment of text within a container. Base
Type: String CSS Inheritance: no ScrollControl
textDecoration
Determines whether the text is underlined. Base
Type: Number Format: Length CSS
Inheritance: yes ScrollControl
textIndent
Offset of first line of text from the left side Base
of the container, in pixels.
Type: uint Format: Color CSS
Inheritance: yes
textRollOverColor Tree
Color of the text when the user rolls over a
row. The default value is 0x2B333C.
Type: uint Format: Color CSS
Inheritance: yes
textSelectedColor Tree
Color of the text when the user selects a
row. The default value is 0x2B333C.
Type: uint Format: Color CSS
themeColor Inheritance: yes UIComponent
Theme color of a component.
Type: Number Format: Length CSS
Inheritance: no
top The vertical distance in pixels from the top UIComponent
edge of the component's parent container
to the top edge of the component.
Type: Boolean CSS Inheritance: no
useRollOver A flag that controls whether items are ListBase
highlighted as the mouse rolls over them.
Type: String CSS Inheritance: no
verticalAlign The vertical alignment of a renderer in a ListBase
row.
Type: Number Format: Length CSS
Inheritance: no
verticalCenter The vertical distance in pixels from the UIComponent
center of the component's parent container
to the center of the component.
verticalScrollBarStyleNa Type: String CSS Inheritance: no ScrollControl
me Style name for vertical scrollbar. Base
Effects
Hide Inherited Effects
Show Inherited Effects
Effect Description Defined by
Triggering event: added
addedEffect Played when the component is added as a UIComponent
child to a Container.
Triggering event: creationComplete
creationCompleteEffect UIComponent
Played when the omponent is created.
Triggering event: focusIn
focusInEffect Played when the component gains keyboard UIComponent
focus.
Triggering event: focusOut
focusOutEffect Played when the component loses keyboard UIComponent
focus.
Triggering event: hide
hideEffect Played when the component becomes UIComponent
invisible.
Triggering event: mouseDown
mouseDownEffect Played when the user presses the mouse UIComponent
button while over the component.
Triggering event: mouseUp
mouseUpEffect Played when the user releases the mouse UIComponent
button while over the component.
Triggering event: move
moveEffect UIComponent
Played when the component is moved.
Triggering event: removed
removedEffect Played when the component is removed UIComponent
from a Container.
Triggering event: resize
resizeEffect UIComponent
Played when the component is resized.
Triggering event: rollOut
rollOutEffect Played when the user rolls the mouse so it is UIComponent
no longer over the component.
Triggering event: rollOver
rollOverEffect Played when the user rolls the mouse over UIComponent
the component.
Triggering event: show
showEffect Played when the component becomes UIComponent
visible.
Public Constants
Hide Inherited Public Constants
Show Inherited Public Constants
Constant Defined by
DEFAULT_MAX_HEIGHT : Number = 10000
UIComponent
[static] The default value for the maxHeight property.
DEFAULT_MAX_WIDTH : Number = 10000
UIComponent
[static] The default value for the maxWidth property.
DEFAULT_MEASURED_HEIGHT : Number = 22
UIComponent
[static] The default value for the measuredHeight property.
DEFAULT_MEASURED_MIN_HEIGHT : Number = 22
UIComponent
[static] The default value for the measuredMinHeight property.
DEFAULT_MEASURED_MIN_WIDTH : Number = 40
UIComponent
[static] The default value for the measuredMinWidth property.
DEFAULT_MEASURED_WIDTH : Number = 160
UIComponent
[static] The default value for the measuredWidth property.
Property detail
dataDescriptorproperty
dataDescriptor:ITreeDataDescriptor [read-write]

Tree delegates to the data descriptor for information about the data. This data is then used
to parse and move about the data source.

When you specify this property as an attribute in MXML you must use a reference to the
data descriptor, not the string name of the descriptor. Use the following format for the
property:

<mx:Tree id="tree" dataDescriptor="{new


MyCustomTreeDataDescriptor()}"/>>

Alternatively, you can specify the property in MXML as a nested subtag, as the following
example shows:

<mx:Tree>
<mx:dataDescriptor>
<myCustomTreeDataDescriptor>

The default value is an internal instance of the DefaultDataDescriptor class.

Implementation
public function get dataDescriptor():ITreeDataDescriptor
public function set dataDescriptor(value:ITreeDataDescriptor):void
dataProviderproperty
dataProvider:Object [read-write]

An object that contains the data to be displayed. When you assign a value to this property,
the Tree class handles the source data object as follows:

• A String containing valid XML text is converted to an XMLListCollection.


• An XMLNode is converted to an XMLListCollection.
• An XMLList is converted to an XMLListCollection.
• Any object that implements the ICollectionView interface is cast to an
ICollectionView.
• An Array is converted to an ArrayCollection.
• Any other type object is wrapped in an Array with the object as its sole entry.

The default value is null.

This property can be used as the source for data binding.

Implementation
public function get dataProvider():Object
public function set dataProvider(value:Object):void
dragMoveEnabledproperty
dragMoveEnabled:Boolean [read-write]

Indicates that items can be moved instead of just copied from the Tree control as part of a
drag-and-drop operation.

The default value is true.

Implementation
public function get dragMoveEnabled():Boolean
public function set dragMoveEnabled(value:Boolean):void
firstVisibleItemproperty
firstVisibleItem:Object [read-write]

The item that is currently displayed in the top row of the tree. Based on how the branches
have been opened and closed and scrolled, the top row might hold, for example, the ninth
item in the list of currently viewable items which in turn represents some great-
grandchild of the root. Setting this property is analogous to setting the
verticalScrollPosition of the List control. If the item isn't currently viewable, for example,
because it is under a nonexpanded item, setting this property has no effect.

NOTE: In Flex 1.0 this property was typed as XMLNode although it really was either an
XMLNode or TreeNode. In 2.0, it is now the generic type Object and will return an
object of the same type as the data contained in the dataProvider.

The default value is the first item in the Tree control.

This property can be used as the source for data binding.

Implementation
public function get firstVisibleItem():Object
public function set firstVisibleItem(value:Object):void
hasRootproperty
hasRoot:Boolean [read-only]

Indicates that the current dataProvider has a root item; for example, a single top node in a
hierarchical structure. XML and Object are examples of types that have a root. Lists and
arrays do not.
Implementation
public function get hasRoot():Boolean

See also

showRoot
itemIconsproperty
public var itemIcons:Object

An object that specifies the icons for the items. Each entry in the object has a field name
that is the item UID and a value that is an an object with the following format:

{iconID: Class, iconID2: Class}

The iconID field value is the class of the icon for a closed or leaf item and the iconID2
is the class of the icon for an open item.

This property is intended to allow initialization of item icons. Changes to this array after
initialization are not detected automatically. Use the setItemIcon() method to change
icons dynamically.

The default value is undefined.

See also

setItemIcon()
maxHorizontalScrollPositionproperty
maxHorizontalScrollPosition:Number [read-write]

The maximum value for the maxHorizontalScrollPosition property for the Tree
control. Unlike the maxHorizontalScrollPosition property in the List control, this
property is modified by the Tree control as items open and close and as items in the tree
otherwise become visible or are hidden (for example, by scrolling).

If you set this property to the widest known item in the dataProvider, the Tree control
modifies it so that even if that widest item is four levels down in the tree, the user can
scroll to see it. As a result, although you read back the same value for the
maxHorizontalScrollPosition property that you set, it isn't necessarily the actual
value used by the Tree control.

The default value is 0.

Implementation
public function get maxHorizontalScrollPosition():Number
public function set maxHorizontalScrollPosition(value:Number):void
openItemsproperty
openItems:Object [read-write]
The items that have been opened or set opened.

The default value is null.

Implementation
public function get openItems():Object
public function set openItems(value:Object):void
showRootproperty
showRoot:Boolean [read-write]

Sets the visibility of the root item. If the dataProvider data has a root node, and this is set
to false, the Tree control does not display the root item. Only the decendants of the root
item are displayed. This flag has no effect on non-rooted dataProviders, such as List and
Array.

The default value is true.

Implementation
public function get showRoot():Boolean
public function set showRoot(value:Boolean):void

See also

hasRoot
Constructor detail
(
Tree constructor
)
public function Tree()

Constructor.

Method detail
(
expandChildrenOf method
)
public function expandChildrenOf(item:Object, open:Boolean):void

Opens or closes all the tree items below the specified item.

Parameters
item:Object — the starting item

open:Boolean — toggles an open or close operation


expandItem() method
public function expandItem(item:Object, open:Boolean, animate:Boolean =
false, dispatchEvent:Boolean = false, cause:Event = null):void

Opens or closes a branch item. When a branch item opens, it restores the open and closed
states of its child branches if they were already opened.
Parameters
item:Object — Item to affect.

open:Boolean — Specify true to open, false to close.

animate:Boolean (default = false) — Specify true to animate the


transition. (Note: If a branch has over 20 children, it does not animate the
first time it opens, for performance reasons.)

dispatchEvent:Boolean (default = false) — Controls whether the tree


fires an open event after the open animation is complete.

cause:Event (default = null) — The event, if any, that initiated the item
open action.
getParentItem() method
public function getParentItem(item:Object):*

Returns the known parent of a child item. This method returns a value only if the item
was or is currently visible. Top level items have a parent with the value null.

Parameters
item:Object — item for which to get the parent
Returns
*— The parent of the item
initListData() method
protected function initListData(item:Object,
treeListData:TreeListData):void

Initializes a TreeListData object that is used by the tree item renderer.

Parameters
item:Object — The item to be rendered.

treeListData:TreeListData — The TreeListDataItem to use in rendering


the item.
isItemOpen() method
public function isItemOpen(item:Object):Boolean

Returns true if the specified item branch is open (is showing its children).

Parameters
item:Object — Item to inspect.
Returns
Boolean — True if open, false if not.
setItemIcon() method
public function setItemIcon(item:Object, iconID:Class,
iconID2:Class):void
Sets the associated icon for the item. Calling this method overrides the iconField and
iconFunction properties for this item if it is a leaf item. Branch items don't use the
iconField and iconFunction properties. They use the folderOpenIcon and
folderClosedIcon properties.

Parameters
item:Object — Item to affect.

iconID:Class — Linkage ID for the closed (or leaf) icon.

iconID2:Class — Linkage ID for the open icon.


Event detail
changeevent
Event object type: flash.events.Event
Event.type property = flash.events.Event.CHANGE

Dispatched when the user selects a tree item.

Defines the value of the type property of a change event object.

This event has the following properties:

Property Value
bubbles true
cancelable false; there is no default behavior to cancel.
currentTarget
The object that is actively processing the Event object with an event
listener.
The object that has had its value modified. The target is not always
target
the object in the display list that registered the event listener. Use the
currentTarget property to access the object in the display list that is
currently processing the event.
itemClose event
Event object type: mx.events.TreeEvent
TreeEvent.type property = mx.events.TreeEvent.ITEM_CLOSE

Dispatched when a branch is closed or collapsed.

The TreeEvent.ITEM_CLOSE event type constant indicates that a tree branch closed or
collapsed.

The properties of the event object for this event type have the following values. Not all
properties are meaningful for all kinds of events. See the detailed property descriptions
for more information.

Property Value
itemRenderer The ListItemRenderer for the node that closed
bubbles false
cancelable false
The Object that defines the event listener that handles the event. For
currentTarget example, if you use myButton.addEventListener() to register an
event listener, myButton is the value of the currentTarget.
triggerEvent
If the node closed in response to a user action, identifies it as a
keyboard action or a mouse action.
node the Tree node that closed
The Object that dispatched the event; it is not always the Object
target listening for the event. Use the currentTarget property to always
access the Object listening for the event.
type TreeEvent.ITEM_CLOSE
itemOpen event
Event object type: mx.events.TreeEvent
TreeEvent.type property = mx.events.TreeEvent.ITEM_OPEN

Dispatched when a branch is opened or expanded.

The TreeEvent.ITEM_OPEN event type constant indicates that a tree branch opened or
expaneded.

The properties of the event object for this event type have the following values. Not all
properties are meaningful for all kinds of events. See the detailed property descriptions
for more information.

Property Value
itemRenderer The ListItemRenderer for the node that opened
bubbles false
cancelable false
The Object that defines the event listener that handles the event. For
currentTarget example, if you use myButton.addEventListener() to register an
event listener, myButton is the value of the currentTarget.
triggerEvent
If the node opened in response to a user action, identifies it as a keyboard
action or a mouse action.
node the Tree node that opened
The Object that dispatched the event; it is not always the Object listening
target for the event. Use the currentTarget property to always access the
Object listening for the event.
type TreeEvent.ITEM_OPEN
itemOpening event
Event object type: mx.events.TreeEvent
TreeEvent.type property = mx.events.TreeEvent.ITEM_OPENING
Dispatched when a branch open or close is initiated.

The TreeEvent.ITEM_OPENING event type constant is dispatched immediately before a


tree opens or closes.

The properties of the event object for this event type have the following values. Not all
properties are meaningful for all kinds of events. See the detailed property descriptions
for more information.

Property Value
animate Whether to animate the opening or closing operation.
bubbles false
cancelable true
The Object that defines the event listener that handles the event. For
currentTarget example, if you use myButton.addEventListener() to register an
event listener, myButton is the value of the currentTarget.
dispatchEvent
Whether to dispatch an ITEM_OPEN or ITEM_CLOSE event after the open
or close animation is complete. true
itemRenderer The ListItemRenderer for the node that opened
node the Tree node that opened
opening true if the item is opening, false if it is closing.
The Object that dispatched the event; it is not always the Object listening
target for the event. Use the currentTarget property to always access the
Object listening for the event.
triggerEvent
If the node opened in response to a user action, identifies it as a keyboard
action or a mouse action.
type TreeEvent.ITEM_OPENING
Examples
TreeExample
<?xml version="1.0" encoding="utf-8"?>
<!-- Tree control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

<mx:Script>
<![CDATA[

[Bindable]
public var selectedNode:Object;

// Event handler for the Tree control change event.


public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem;
}
]]>
</mx:Script>

<mx:XMLList id="treeData">
<node label="Mail Box">
<node label="Inbox">
<node label="Marketing"/>
<node label="Product Management"/>
<node label="Personal"/>
</node>
<node label="Outbox">
<node label="Professional"/>
<node label="Personal"/>
</node>
<node label="Spam"/>
<node label="Sent"/>
</node>
</mx:XMLList>

<mx:Panel title="Tree Control Example" height="75%" width="75%"


paddingTop="10" paddingLeft="10" paddingRight="10"
paddingBottom="10">

<mx:Label width="100%" color="blue"


text="Select a node in the Tree control."/>

<mx:HDividedBox width="100%" height="100%">


<mx:Tree id="myTree" width="50%" height="100%"
labelField="@label"
showRoot="false" dataProvider="{treeData}"
change="treeChanged(event)"/>
<mx:TextArea height="100%" width="50%"
text="Selected Item: {selectedNode.@label}"/>
</mx:HDividedBox>

</mx:Panel>
</mx:Application>

Vous aimerez peut-être aussi