Package | fl.controls |
Class | public class ComboBox |
Inheritance | ComboBox UIComponent Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object |
Implements | IFocusManagerComponent |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Related API Elements
Property | Defined By | ||
---|---|---|---|
accessibilityImplementation : AccessibilityImplementation
The current accessibility implementation (AccessibilityImplementation)
for this InteractiveObject instance. | InteractiveObject | ||
accessibilityProperties : AccessibilityProperties
The current accessibility options for this display object. | DisplayObject | ||
alpha : Number
Indicates the alpha transparency value of the object specified. | DisplayObject | ||
blendMode : String
A value from the BlendMode class that specifies which blend mode to use. | DisplayObject | ||
blendShader : Shader [write-only]
Sets a shader that is used for blending the foreground and background. | DisplayObject | ||
buttonMode : Boolean
Specifies the button mode of this sprite. | Sprite | ||
cacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the
display object. | DisplayObject | ||
cacheAsBitmapMatrix : Matrix
If non-null, this Matrix object defines how a display object is rendered when
cacheAsBitmap is set to true. | DisplayObject | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
contextMenu : NativeMenu
Specifies the context menu associated with this object. | InteractiveObject | ||
dataProvider : DataProvider
Gets or sets the data model of the list of items to be viewed. | ComboBox | ||
doubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events. | InteractiveObject | ||
dropdown : List [read-only]
Gets a reference to the List component that the ComboBox component contains. | ComboBox | ||
dropdownWidth : Number
Gets or sets the maximum width of the drop-down list, in pixels. | ComboBox | ||
dropTarget : DisplayObject [read-only]
Specifies the display object over which the sprite is being dragged, or on
which the sprite was dropped. | Sprite | ||
editable : Boolean
Gets or sets a Boolean value that indicates whether the ComboBox
component is editable or read-only. | ComboBox | ||
enabled : Boolean
Gets or sets a value that indicates whether the component can accept user interaction. | UIComponent | ||
filters : Array
An indexed array that contains each filter object currently associated with the display object. | DisplayObject | ||
focusEnabled : Boolean
Gets or sets a Boolean value that indicates whether the component can receive focus
after the user clicks it. | UIComponent | ||
focusManager : IFocusManager
Gets or sets the FocusManager that controls focus for this component and its
peers. | UIComponent | ||
focusRect : Object
Specifies whether this object displays a focus rectangle. | InteractiveObject | ||
graphics : Graphics [read-only]
Specifies the Graphics object that belongs to this sprite where vector
drawing commands can occur. | Sprite | ||
height : Number [override]
Gets or sets the height of the component, in pixels. | UIComponent | ||
hitArea : Sprite
Designates another sprite to serve as the hit area for a sprite. | Sprite | ||
labelField : String
Gets or sets the name of the field in the dataProvider object
to be displayed as the label for the TextInput field and drop-down list. | ComboBox | ||
labelFunction : Function
Gets or sets the function to be used to obtain the label for the item. | ComboBox | ||
length : int [read-only]
Gets the number of items in the list. | ComboBox | ||
loaderInfo : LoaderInfo [read-only]
Returns a LoaderInfo object containing information about loading the file
to which this display object belongs. | DisplayObject | ||
mask : DisplayObject
The calling display object is masked by the specified mask object. | DisplayObject | ||
metaData : Object
Obtains the meta data object of the DisplayObject instance if meta data was stored alongside the
the instance of this DisplayObject in the SWF file through a PlaceObject4 tag. | DisplayObject | ||
mouseChildren : Boolean
Determines whether or not the children of the object are mouse, or user input device, enabled. | DisplayObjectContainer | ||
mouseEnabled : Boolean
Specifies whether this object receives mouse, or other user input, messages. | InteractiveObject | ||
mouseFocusEnabled : Boolean
Gets or sets a value that indicates whether the component can receive focus after
the user clicks it. | UIComponent | ||
mouseX : Number [read-only]
Indicates the x coordinate of the mouse or user input device position, in pixels. | DisplayObject | ||
mouseY : Number [read-only]
Indicates the y coordinate of the mouse or user input device position, in pixels. | DisplayObject | ||
name : String
Indicates the instance name of the DisplayObject. | DisplayObject | ||
needsSoftKeyboard : Boolean
Specifies whether a virtual keyboard (an on-screen, software keyboard) should display
when this InteractiveObject instance receives focus. | InteractiveObject | ||
numChildren : int [read-only]
Returns the number of children of this object. | DisplayObjectContainer | ||
opaqueBackground : Object
Specifies whether the display object is opaque with a certain background color. | DisplayObject | ||
parent : DisplayObjectContainer [read-only]
Indicates the DisplayObjectContainer object that contains this display object. | DisplayObject | ||
prompt : String
Gets or sets the prompt for the ComboBox component. | ComboBox | ||
restrict : String
Gets or sets the characters that a user can enter in the text field. | ComboBox | ||
root : DisplayObject [read-only]
For a display object in a loaded SWF file, the root property is the
top-most display object in the portion of the display list's tree structure represented by that SWF file. | DisplayObject | ||
rotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. | DisplayObject | ||
rotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rowCount : uint
Gets or sets the maximum number of rows that can appear in a drop-down
list that does not have a scroll bar. | ComboBox | ||
scale9Grid : Rectangle
The current scaling grid that is in effect. | DisplayObject | ||
scaleX : Number [override]
Multiplies the current width of the component by a scale factor. | UIComponent | ||
scaleY : Number [override]
Multiplies the current height of the component by a scale factor. | UIComponent | ||
scaleZ : Number
Indicates the depth scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | ||
scrollRect : Rectangle
The scroll rectangle bounds of the display object. | DisplayObject | ||
selectedIndex : int
Gets or sets the index of the item that is selected in a single-selection
list. | ComboBox | ||
selectedItem : Object
Gets or sets the value of the item that is selected in the drop-down list. | ComboBox | ||
selectedLabel : String [read-only]
Gets the string that is displayed in the TextInput portion
of the ComboBox component. | ComboBox | ||
softKeyboard : String
Controls the appearance of the soft keyboard. | InteractiveObject | ||
softKeyboardInputAreaOfInterest : Rectangle
Defines the area that should remain on-screen when a soft keyboard is displayed (not available on iOS). | InteractiveObject | ||
soundTransform : flash.media:SoundTransform
Controls sound within this sprite. | Sprite | ||
stage : Stage [read-only]
The Stage of the display object. | DisplayObject | ||
tabChildren : Boolean
Determines whether the children of the object are tab enabled. | DisplayObjectContainer | ||
tabEnabled : Boolean
Specifies whether this object is in the tab order. | InteractiveObject | ||
tabIndex : int
Specifies the tab ordering of objects in a SWF file. | InteractiveObject | ||
text : String
Gets or sets the text that the text box contains in an editable ComboBox component. | ComboBox | ||
textField : fl.controls:TextInput [read-only]
Gets a reference to the TextInput component that the ComboBox
component contains. | ComboBox | ||
textSnapshot : flash.text:TextSnapshot [read-only]
Returns a TextSnapshot object for this DisplayObjectContainer instance. | DisplayObjectContainer | ||
transform : flash.geom:Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. | DisplayObject | ||
useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the pointer rolls
over a sprite in which the buttonMode property is set to true. | Sprite | ||
value : String [read-only]
Gets the label of an item in an editable ComboBox component. | ComboBox | ||
visible : Boolean [override]
Gets or sets a value that indicates whether the current component instance is visible. | UIComponent | ||
width : Number [override]
Gets or sets the width of the component, in pixels. | UIComponent | ||
x : Number [override]
Gets or sets the x coordinate that represents the position of the component along
the x axis within its parent container. | UIComponent | ||
y : Number [override]
Gets or sets the y coordinate that represents the position of the component along
the y axis within its parent container. | UIComponent | ||
z : Number
Indicates the z coordinate position along the z-axis of the DisplayObject
instance relative to the 3D parent container. | DisplayObject |
Method | Defined By | ||
---|---|---|---|
ComboBox()
Creates a new ComboBox component instance. | ComboBox | ||
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | DisplayObjectContainer | ||
Adds a child DisplayObject instance to this DisplayObjectContainer
instance. | DisplayObjectContainer | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | ||
Appends an item to the end of the list of items. | ComboBox | ||
Inserts an item into the list at the specified index location. | ComboBox | ||
Indicates whether the security restrictions
would cause any display objects to be omitted from the list returned by calling
the DisplayObjectContainer.getObjectsUnderPoint() method
with the specified point point. | DisplayObjectContainer | ||
Deletes a style property from this component instance. | UIComponent | ||
Closes the drop-down list. | ComboBox | ||
Determines whether the specified display object is a child of the DisplayObjectContainer instance or
the instance itself. | DisplayObjectContainer | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Shows or hides the focus indicator on this component. | UIComponent | ||
Initiates an immediate draw operation, without invalidating everything as invalidateNow does. | UIComponent | ||
Returns a rectangle that defines the area of the display object relative to the coordinate system
of the targetCoordinateSpace object. | DisplayObject | ||
Returns the child display object instance that exists at the specified index. | DisplayObjectContainer | ||
Returns the child display object that exists with the specified name. | DisplayObjectContainer | ||
Returns the index position of a child DisplayObject instance. | DisplayObjectContainer | ||
Retrieves the object that currently has focus. | UIComponent | ||
Retrieves the item at the specified index. | ComboBox | ||
Returns an array of objects that lie under the specified point and are children
(or grandchildren, and so on) of this DisplayObjectContainer instance. | DisplayObjectContainer | ||
Returns a rectangle that defines the boundary of the display object,
based on the coordinate system defined by the targetCoordinateSpace
parameter, excluding any strokes on shapes. | DisplayObject | ||
Retrieves a style property that is set in the style lookup
chain of the component. | UIComponent | ||
[static]
Retrieves the default style map for the current component. | ComboBox | ||
Converts the point object from the Stage (global) coordinates
to the display object's (local) coordinates. | DisplayObject | ||
Converts a two-dimensional point from the Stage (global) coordinates to a
three-dimensional display object's (local) coordinates. | DisplayObject | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
Indicates whether an object has a specified property defined. | Object | ||
Evaluates the bounding box of the display object to see if it overlaps or intersects with the
bounding box of the obj display object. | DisplayObject | ||
Evaluates the display object to see if it overlaps or intersects with the
point specified by the x and y parameters. | DisplayObject | ||
Marks a property as invalid and redraws the component on the
next frame unless otherwise specified. | UIComponent | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Retrieves the string that the renderer displays for the given data object
based on the labelField and labelFunction properties. | ComboBox | ||
Converts a three-dimensional point of the three-dimensional display
object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates. | DisplayObject | ||
Converts the point object from the display object's (local) coordinates to the
Stage (global) coordinates. | DisplayObject | ||
[static]
Merges the styles from multiple classes into one object. | UIComponent | ||
Moves the component to the specified position within its parent. | UIComponent | ||
Opens the drop-down list. | ComboBox | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes all items from the list. | ComboBox | ||
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | ||
Removes a child DisplayObject from the specified index position in the child list of
the DisplayObjectContainer. | DisplayObjectContainer | ||
Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Removes the specified item from the list. | ComboBox | ||
Removes the item at the specified index position. | ComboBox | ||
Replaces the item at the specified index location with another item. | ComboBox | ||
Raises a virtual keyboard. | InteractiveObject | ||
Changes the position of an existing child in the display object container. | DisplayObjectContainer | ||
Sets the focus to this component. | UIComponent | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
Sets the component to the specified width and height. | UIComponent | ||
Sets a style property on this component instance. | UIComponent | ||
Sorts the elements of the current data provider. | ComboBox | ||
Sorts the elements of the current data provider by one or more
of its fields. | ComboBox | ||
Lets the user drag the specified sprite. | Sprite | ||
Lets the user drag the specified sprite on a touch-enabled device. | Sprite | ||
Recursively stops the timeline execution of all MovieClips rooted at this object. | DisplayObjectContainer | ||
Ends the startDrag() method. | Sprite | ||
Ends the startTouchDrag() method, for use with touch-enabled devices. | Sprite | ||
Swaps the z-order (front-to-back order) of the two specified child objects. | DisplayObjectContainer | ||
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the
child list. | DisplayObjectContainer | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Validates and updates the properties and layout of this object, redrawing it
if necessary. | UIComponent | ||
Returns the primitive value of the specified object. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Event | Summary | Defined By | ||
---|---|---|---|---|
[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | |||
Dispatched when a display object is added to the display list. | DisplayObject | |||
Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained. | DisplayObject | |||
Dispatched when the user changes the selection in the ComboBox component or, if the ComboBox component is editable, each time the user enters a keystroke in the text field. | ComboBox | |||
Dispatched when the user selects 'Clear' (or 'Delete') from the text context menu. | InteractiveObject | |||
Dispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject. | InteractiveObject | |||
Dispatched when the drop-down list is dismissed for any reason. | ComboBox | |||
Dispatched when a user gesture triggers the context menu associated with this interactive object in an AIR application. | InteractiveObject | |||
Dispatched when the user activates the platform-specific accelerator key combination for a copy operation or selects 'Copy' from the text context menu. | InteractiveObject | |||
Dispatched when the user activates the platform-specific accelerator key combination for a cut operation or selects 'Cut' from the text context menu. | InteractiveObject | |||
[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | |||
Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same InteractiveObject when that object's doubleClickEnabled flag is set to true. | InteractiveObject | |||
Dispatched if the editable property is set to true and the user presses the Enter key while typing in the editable text field. | ComboBox | |||
[broadcast event] Dispatched when the playhead is entering a new frame. | DisplayObject | |||
[broadcast event] Dispatched when the playhead is exiting the current frame. | DisplayObject | |||
Dispatched after a display object gains focus. | InteractiveObject | |||
Dispatched after a display object loses focus. | InteractiveObject | |||
[broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run. | DisplayObject | |||
Dispatched when the user creates a point of contact along the edge of the touch surface with an InteractiveObject instance, (such as tapping along the edge of the touch surface on Siri Remote for Apple TV) Some devices might also interpret this contact as a combination of several touch events, as well. | InteractiveObject | |||
Dispatched when the user presses two points of contact over the same InteractiveObject instance on a touch-enabled device (such as presses and releases two fingers over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves a point of contact over the InteractiveObject instance on a touch-enabled device (such as moving a finger from left to right over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user performs a rotation gesture at a point of contact with an InteractiveObject instance (such as touching two fingers and rotating them over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user performs a swipe gesture at a point of contact with an InteractiveObject instance (such as touching three fingers to a screen and then moving them in parallel over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user creates a point of contact with an InteractiveObject instance, then taps on a touch-enabled device (such as placing several fingers over a display object to open a menu and then taps one finger to select a menu item on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user performs a zoom gesture at a point of contact with an InteractiveObject instance (such as touching two fingers to a screen and then quickly spreading the fingers apart over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched after the component visibility changes from visible to invisible. | UIComponent | |||
This event is dispatched to any client app that supports inline input with an IME | InteractiveObject | |||
Defines the value of the type property of an itemRollOut event object. | ComboBox | |||
Defines the value of the type property of an itemRollOver event object. | ComboBox | |||
Dispatched when the user presses a key. | InteractiveObject | |||
Dispatched when the user attempts to change focus by using keyboard navigation. | InteractiveObject | |||
Dispatched when the user releases a key. | InteractiveObject | |||
Dispatched when a user presses and releases the middle button of the user's pointing device over the same InteractiveObject. | InteractiveObject | |||
Dispatched when a user presses the middle pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user attempts to change focus by using a pointer device. | InteractiveObject | |||
Dispatched when a user moves the pointing device while it is over an InteractiveObject. | InteractiveObject | |||
Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a mouse wheel is spun over an InteractiveObject instance. | InteractiveObject | |||
Dispatched after the component is moved. | UIComponent | |||
Dispatched by the drag initiator InteractiveObject when the user releases the drag gesture. | InteractiveObject | |||
Dispatched by the target InteractiveObject when a dragged object is dropped on it and the drop has been accepted with a call to DragManager.acceptDragDrop(). | InteractiveObject | |||
Dispatched by an InteractiveObject when a drag gesture enters its boundary. | InteractiveObject | |||
Dispatched by an InteractiveObject when a drag gesture leaves its boundary. | InteractiveObject | |||
Dispatched by an InteractiveObject continually while a drag gesture remains within its boundary. | InteractiveObject | |||
Dispatched at the beginning of a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | |||
Dispatched during a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | |||
Dispatched when the user clicks the drop-down button to display the drop-down list. | ComboBox | |||
Dispatched when the user activates the platform-specific accelerator key combination for a paste operation or selects 'Paste' from the text context menu. | InteractiveObject | |||
Dispatched when the user lowers an active stylus past the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user lifts an active stylus above the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus over the screen while remaining within the proximity detection threshold. | InteractiveObject | |||
Dispatched when the user moves an active stylus away from this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus directly above this InteractiveObject while remaining within the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus away from this InteractiveObject and any of its children while remaining within the proximity detection threshold of the screen. | InteractiveObject | |||
Dispatched when the user moves an active stylus over this InteractiveObject from outside the object's tree of descendents in the display list (while remaining within the proximity detection threshold of the screen). | InteractiveObject | |||
Dispatched when a user releases the button on the pointing device after the user first pressed the button over an InteractiveObject instance and then moved the pointing device off of the InteractiveObject instance. | InteractiveObject | |||
Dispatched when a display object is about to be removed from the display list. | DisplayObject | |||
Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained. | DisplayObject | |||
[broadcast event] Dispatched when the display list is about to be updated and rendered. | DisplayObject | |||
Dispatched after the component is resized. | UIComponent | |||
Dispatched when a user presses and releases the right button of the user's pointing device over the same InteractiveObject. | InteractiveObject | |||
Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | |||
Dispatched when the user scrolls the drop-down list of the ComboBox component. | ComboBox | |||
Dispatched when the user activates the platform-specific accelerator key combination for a select all operation or selects 'Select All' from the text context menu. | InteractiveObject | |||
Dispatched after the component visibility changes from invisible to visible. | UIComponent | |||
Dispatched immediately after the soft keyboard is raised. | InteractiveObject | |||
Dispatched immediately before the soft keyboard is raised. | InteractiveObject | |||
Dispatched immediately after the soft keyboard is lowered. | InteractiveObject | |||
Dispatched when the value of the object's tabChildren flag changes. | InteractiveObject | |||
Dispatched when the object's tabEnabled flag changes. | InteractiveObject | |||
Dispatched when the value of the object's tabIndex property changes. | InteractiveObject | |||
Dispatched when a user enters one or more characters of text. | InteractiveObject | |||
Dispatched when the user first contacts a touch-enabled device (such as touches a finger to a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user removes contact with a touch-enabled device (such as lifts a finger off a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user touches the device, and is continuously dispatched until the point of contact is removed. | InteractiveObject | |||
Dispatched when the user moves the point of contact away from InteractiveObject instance on a touch-enabled device (such as drags a finger from one display object to another on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact away from an InteractiveObject instance on a touch-enabled device (such as drags a finger from over a display object to a point outside the display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user moves the point of contact over an InteractiveObject instance on a touch-enabled device (such as drags a finger from a point outside a display object to a point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject | |||
Dispatched when the user lifts the point of contact over the same InteractiveObject instance on which the contact was initiated on a touch-enabled device (such as presses and releases a finger from a single point over a display object on a mobile phone or tablet with a touch screen). | InteractiveObject |
Styles are either common or associated with a specific theme. If the style is common, it can be used with any theme. If a style is associated with a specific theme, it can only be used if your application uses that theme.
Style | Description | Defined By | ||
---|---|---|---|---|
buttonWidth | Type: Number Format: Length Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The space that separates the right edge of the component from the text representing the selected item, in pixels. The button is part of the background skin. The default value is 24 . | ComboBox | ||
cellRenderer | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The class that provides the cell renderer for each item in the component. The default value is fl.controls.listClasses.CellRenderer . | ComboBox | ||
contentPadding | Type: Number Format: Length Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Padding between the content (the component and scroll bar), and the outside edge of the background, in pixels. The default value is 3 . | ComboBox | ||
disabledAlpha | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The alpha value to set the list to when the enabled property is false .
The default value is 0.5 . | ComboBox | ||
disabledSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The name of the class that provides the background that appears in the ComboBox component when the enabled property of the
component is set to false .
The default value is ComboBox_disabledSkin . | ComboBox | ||
Type: flash.text.TextFormat Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The TextFormat object to use to render the component label when the button is disabled. | UIComponent | |||
downArrowDisabledSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the down arrow button of the scroll bar when it is disabled. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowDown_disabledSkin . | ComboBox | ||
downArrowDownSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the down arrow button of the scroll bar when you click the arrow button. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowDown_downSkin . | ComboBox | ||
downArrowOverSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the down arrow button of the scroll bar when the mouse pointer is over the arrow button. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowDown_overSkin . | ComboBox | ||
downArrowUpSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the down arrow button of the scroll bar. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowDown_upSkin . | ComboBox | ||
downSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The name of the class that provides the background that appears in the ComboBox component when the mouse is down. The default value is ComboBox_downSkin . | ComboBox | ||
embedFonts | Type: Boolean Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Indicates whether embedded font outlines are used to render the text field. If this value is true , Flash Player renders the text field
by using embedded font outlines. If this value is false ,
Flash Player renders the text field by using device fonts.
If you set the false . | ComboBox | ||
Type: Number Format: Length Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The padding that separates the outside boundaries of the component from the outside edges of the focus indicator, in pixels. | UIComponent | |||
Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The skin to be used to display focus indicators. | UIComponent | |||
overSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The name of the class that provides the background that appears in the ComboBox component when the mouse is over it. The default value is ComboBox_overSkin . | ComboBox | ||
repeatDelay | Type: Number Format: Time Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The number of milliseconds to wait after the buttonDown
event is first dispatched before sending a second buttonDown
event.
The default value is 500 . | ComboBox | ||
repeatInterval | Type: Number Format: Time Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The interval, in milliseconds, between buttonDown events
that are dispatched after the delay that is specified by the repeatDelay
style.
The default value is 35 . | ComboBox | ||
Type: flash.text.TextFormat Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The TextFormat object to use to render the component label. | UIComponent | |||
textPadding | Type: Number Format: Length Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The space that separates the border from the text representing the selected item, in pixels. The default value is 3 . | ComboBox | ||
thumbArrowUpSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin used for the thumb of the scroll bar. The default value is ScrollThumb_upSkin . | ComboBox | ||
thumbDisabledSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The skin that is used to indicate the disabled state of the thumb. The default value is ScrollThumb_upSkin . | ComboBox | ||
thumbDownSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the thumb of the scroll bar when you click the thumb. The default value is ScrollThumb_downSkin . | ComboBox | ||
thumbIcon | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the icon for the thumb of the scroll bar. The default value is ScrollBar_thumbIcon . | ComboBox | ||
thumbOverSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the thumb of the scroll bar when the mouse pointer is over the thumb. The default value is ScrollThumb_overSkin . | ComboBox | ||
trackDisabledSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The skin that is used to indicate a disabled track. The default value is ScrollTrack_Skin . | ComboBox | ||
trackDownSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The skin that is used to indicate the down state of a disabled skin. The default value is ScrollTrack_Skin . | ComboBox | ||
trackOverSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The skin that is used to indicate the mouseover state for the scroll track. The default value is ScrollTrack_Skin . | ComboBox | ||
trackUpSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The skin used to indicate the mouse up state for the scroll track. The default value is ScrollTrack_Skin . | ComboBox | ||
upArrowDisabledSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the up arrow button of the scroll bar when it is disabled. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowUp_disabledSkin . | ComboBox | ||
upArrowDownSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the up arrow button of the scroll bar when you click the arrow button. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowUp_downSkin . | ComboBox | ||
upArrowOverSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the up arrow button of the scroll bar when the mouse pointer is over the arrow button. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowUp_overSkin . | ComboBox | ||
upArrowUpSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 Name of the class to use as the skin for the up arrow button of the scroll bar. If you change the skin, either graphically or programmatically, you should ensure that the new skin is the same height (for horizontal scroll bars) or width (for vertical scroll bars) as the track. The default value is ScrollArrowUp_upSkin . | ComboBox | ||
upSkin | Type: Class Language Version: ActionScript 3.0 Product Version: Flash CS3 Runtime Versions: Flash9.0.28.0, AIR 1.0 The name of the class that provides the background of the ComboBox component. The default value is ComboBox_upSkin . | ComboBox |
dataProvider | property |
dataProvider:DataProvider
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the data model of the list of items to be viewed. A data provider can be shared by multiple list-based components. Changes to the data provider are immediately available to all components that use it as a data source.
Implementation
public function get dataProvider():DataProvider
public function set dataProvider(value:DataProvider):void
Related API Elements
Example ( How to use this example )
import fl.controls.ComboBox; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); var cb:ComboBox = new ComboBox(); cb.dataProvider = dp; addChild(cb); var counter = 0; var t:Timer = new Timer(500); t.addEventListener(TimerEvent.TIMER,addAnotherItem); t.start(); function addAnotherItem(e:TimerEvent = null):void { dp.addItem( { label: "Item " + counter++ } ); }
dropdown | property |
dropdown:List
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets a reference to the List component that the ComboBox component contains.
The List subcomponent is not instantiated within the ComboBox until it
must be displayed. However, the list is created when the dropdown
property is accessed.
Implementation
public function get dropdown():List
dropdownWidth | property |
dropdownWidth:Number
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the maximum width of the drop-down list, in pixels. The default value of this property is the width of the ComboBox component (the width of the TextInput instance plus the width of the BaseButton instance).
The default value is 100.
Implementation
public function get dropdownWidth():Number
public function set dropdownWidth(value:Number):void
Example ( How to use this example )
dropdownWidth
property based on the value of a Slider component:
import fl.controls.ComboBox; import fl.controls.Slider; import fl.events.SliderEvent; var mySlider:Slider = new Slider(); mySlider.minimum = 50; mySlider.maximum = 150; mySlider.liveDragging = true; mySlider.snapInterval = 5; mySlider.tickInterval = 10; mySlider.addEventListener(SliderEvent.CHANGE, changeHandler); mySlider.move(10, 10); addChild(mySlider); var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item A"}); myComboBox.addItem({label:"Item B"}); myComboBox.move(10, 30); addChild(myComboBox); mySlider.value = myComboBox.dropdownWidth; function changeHandler(event:SliderEvent):void { myComboBox.dropdownWidth = event.value; }
dropdownWidth
property based on the length of the text in the drop-down list:
import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"The quick brown fox"}); myComboBox.addItem({label:"Lorem ipsum"}); myComboBox.addItem({label:"Little Miss Muffet"}); myComboBox.addItem({label:"Goldilocks and the three bears"}); myComboBox.addItem({label:"Jack and Jill"}); myComboBox.move(10, 30); addChild(myComboBox); var maxLength:Number = 0; var i:uint; for (i = 0; i < myComboBox.length; i++) { myComboBox.selectedIndex = i; myComboBox.drawNow(); var currText:String = myComboBox.text; var currWidth:Number = myComboBox.textField.textWidth; maxLength = Math.max(currWidth, maxLength); trace(currText, currWidth, maxLength); } myComboBox.selectedIndex = -1; myComboBox.dropdownWidth = maxLength + 20; myComboBox.open();
editable | property |
editable:Boolean
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets a Boolean value that indicates whether the ComboBox
component is editable or read-only. A value of true
indicates
that the ComboBox component is editable; a value of false
indicates that it is not.
In an editable ComboBox component, a user can enter values into the text box that do not appear in the drop-down list. The text box displays the text of the item in the list. If a ComboBox component is not editable, text cannot be entered into the text box.
The default value is false.
Implementation
public function get editable():Boolean
public function set editable(value:Boolean):void
Example ( How to use this example )
enter
event is dispatched:
import fl.controls.ComboBox; import fl.data.DataProvider; import fl.events.ComponentEvent; var dp:DataProvider = new DataProvider(); var myComboBox:ComboBox = new ComboBox; myComboBox.dataProvider = dp; myComboBox.editable = true; myComboBox.addEventListener(ComponentEvent.ENTER, enterHandler); myComboBox.move(10, 10); addChild(myComboBox); function enterHandler(event:ComponentEvent):void { var myCB:ComboBox = event.currentTarget as ComboBox; dp.addItem({label:myCB.text}); myCB.text = ""; myCB.sortItemsOn("label", Array.CASEINSENSITIVE); }
labelField | property |
labelField:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the name of the field in the dataProvider
object
to be displayed as the label for the TextInput field and drop-down list.
By default, the component displays the label
property
of each dataProvider
item. If the dataProvider
items do not contain a label
property, you can set the
labelField
property to use a different property.
Note: The labelField
property is not used
if the labelFunction
property is set to a callback function.
The default value is "label".
Implementation
public function get labelField():String
public function set labelField(value:String):void
Related API Elements
Example ( How to use this example )
labelField
property to set a custom label field:
import fl.controls.ComboBox; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem({firstName:"Jane", lastName:"Doe"}); dp.addItem({firstName:"Bill", lastName:"Smith"}); dp.addItem({firstName:"Tim", lastName:"Jones"}); dp.sortOn(["firstName","lastName"]); var myComboBox:ComboBox = new ComboBox(); myComboBox.dataProvider = dp; myComboBox.labelField = "firstName"; myComboBox.move(10, 10); addChild(myComboBox);
labelFunction | property |
labelFunction:Function
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the function to be used to obtain the label for the item.
By default, the component displays the label
property
for a dataProvider
item. But some data sets may not have
a label
field or may not have a field whose value
can be used as a label without modification. For example, a given data
set might store full names but maintain them in lastName
and
firstName
fields. In such a case, this property could be
used to set a callback function that concatenates the values of the
lastName
and firstName
fields into a full
name string to be displayed.
Note: The labelField
property is not used
if the labelFunction
property is set to a callback function.
Implementation
public function get labelFunction():Function
public function set labelFunction(value:Function):void
Related API Elements
Example ( How to use this example )
labelFunction
property of a list to a function that formats the string to be displayed in each cell:
import fl.data.DataProvider; import fl.controls.List; var myDataProvider:DataProvider = new DataProvider(); myDataProvider.addItem({name:"User A", price:0.43}); myDataProvider.addItem({name:"User B", price:0.34}); var users:List = new List(); users.dataProvider = myDataProvider; users.labelFunction = myLabelFunction; addChild(users); function myLabelFunction(item:Object):String { return item.name + " ($" + item.price.toFixed(2) + ")"; }
labelField
property to set a custom label field:
import fl.controls.ComboBox; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem({firstName:"Jane", lastName:"Doe"}); dp.addItem({firstName:"Bill", lastName:"Smith"}); dp.addItem({firstName:"Tim", lastName:"Jones"}); dp.sortOn(["lastName", "firstName"]); var myComboBox:ComboBox = new ComboBox(); myComboBox.dataProvider = dp; myComboBox.labelFunction = nameLabelFunction; myComboBox.move(10, 10); addChild(myComboBox); function nameLabelFunction(item:Object):String { return item.lastName + ", " + item.firstName; }
length | property |
length:int
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets the number of items in the list. This property belongs to the List component but can be accessed from a ComboBox instance.
The default value is 0.
Implementation
public function get length():int
Related API Elements
Example ( How to use this example )
rowCount
property based on how many items are in the ComboBox:
import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item A"}); myComboBox.addItem({label:"Item B"}); myComboBox.addItem({label:"Item C"}); myComboBox.addItem({label:"Item D"}); myComboBox.addItem({label:"Item E"}); myComboBox.addItem({label:"Item F"}); myComboBox.rowCount = myComboBox.length / 2; addChild(myComboBox);
rowCount
property based on how many items are in the ComboBox:
import fl.controls.ComboBox; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem({label:"Item A"}); dp.addItem({label:"Item B"}); dp.addItem({label:"Item C"}); dp.addItem({label:"Item D"}); dp.addItem({label:"Item E"}); dp.addItem({label:"Item F"}); var myComboBox:ComboBox = new ComboBox(); myComboBox.dataProvider = dp; myComboBox.rowCount = myComboBox.length / 2; addChild(myComboBox);
prompt | property |
prompt:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the prompt for the ComboBox component. This prompt is a string
that is displayed in the TextInput portion of the ComboBox when
the selectedIndex
is -1. It is usually a string like "Select one...".
If a prompt is not set, the ComboBox component sets the selectedIndex
property
to 0 and displays the first item in the dataProvider
property.
The default value is "".
Implementation
public function get prompt():String
public function set prompt(value:String):void
Example ( How to use this example )
prompt
property and resizes the combo box to fit the width of the prompt text:
import fl.controls.ComboBox; var cbStyles:Object = ComboBox.getStyleDefinition(); var bW:Number = cbStyles.buttonWidth as Number var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Please select an option..."; myComboBox.addItem({label:"Option 1"}); myComboBox.addItem({label:"Option 2"}); myComboBox.drawNow(); myComboBox.width = myComboBox.textField.textWidth + 35; myComboBox.dropdownWidth = myComboBox.width - bW; myComboBox.move(10, 10); addChild(myComboBox);
prompt
property based on the number of items in its data provider:
import fl.controls.ComboBox; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem({label:"Getting Started"}); dp.addItem({label:"New Features"}); dp.addItem({label:"ActionScript"}); dp.addItem({label:"Components"}); dp.sortOn("label", Array.CASEINSENSITIVE); var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Topics (" + dp.length + ")"; myComboBox.dataProvider = dp; myComboBox.width = 150; myComboBox.move(10, 10); addChild(myComboBox);
restrict | property |
restrict:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the characters that a user can enter in the text field.
If the value of the restrict
property is
a string of characters, you can enter only characters in the string
into the text field. The string is read from left to right. If
the value of the restrict
property is null
, you
can enter any character. If the value of the restrict
property is an empty string (""), you cannot enter any character.
You can specify a range by using the hyphen (-) character. This restricts
only user interaction; a script can put any character into the text
field.
The default value is null.
Implementation
public function get restrict():String
public function set restrict(value:String):void
Related API Elements
Example ( How to use this example )
restrict
property:
import fl.controls.ComboBox; import fl.data.DataProvider; import fl.events.ComponentEvent; var dp:DataProvider = new DataProvider(); var myComboBox:ComboBox = new ComboBox(); myComboBox.dataProvider = dp; myComboBox.editable = true; myComboBox.restrict = "0-9A-F"; myComboBox.textField.maxChars = 6; myComboBox.addEventListener(ComponentEvent.ENTER, enterHandler); myComboBox.move(10, 10); addChild(myComboBox); function enterHandler(event:ComponentEvent):void { var colorStr:String = ComboBox(event.currentTarget).text; var colorNum:uint = uint("0x" + colorStr); dp.addItem({label:colorStr, value:colorNum}); dp.sortOn("value", Array.NUMERIC); event.currentTarget.text = ""; }
rowCount | property |
rowCount:uint
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the maximum number of rows that can appear in a drop-down list that does not have a scroll bar. If the number of items in the drop-down list exceeds this value, the list is resized and a scroll bar is displayed, if necessary. If the number of items in the drop-down list is less than this value, the drop-down list is resized to accommodate the number of items that it contains.
This behavior differs from that of the List component, which always shows the number
of rows specified by its rowCount
property, even if this includes empty space.
The default value is 5.
Implementation
public function get rowCount():uint
public function set rowCount(value:uint):void
Related API Elements
Example ( How to use this example )
rowCount
property for a ComboBox component:
import fl.controls.ComboBox; import fl.controls.Slider; import fl.events.SliderEvent; var numItems:uint = 8; var mySlider:Slider = new Slider(); mySlider.tickInterval = 1; mySlider.snapInterval = 1; mySlider.minimum = 1; mySlider.maximum = numItems; mySlider.liveDragging = true; mySlider.move(10, 10); mySlider.addEventListener(SliderEvent.CHANGE, changeHandler); addChild(mySlider); var myComboBox:ComboBox = new ComboBox(); myComboBox.move(10, 30); addChild(myComboBox); var i:uint; for (i = 0; i < numItems; i++) { myComboBox.addItem({label:"Item " + i}); } function changeHandler(event:SliderEvent):void { myComboBox.rowCount = event.value; }
selectedIndex | property |
selectedIndex:int
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the index of the item that is selected in a single-selection list. A single-selection list is a list in which only one item can be selected at a time.
A value of -1 indicates that no item is selected; if multiple selections are made, this value is equal to the index of the item that was selected last in the group of selected items.
When ActionScript is used to set this property, the item at the specified index
replaces the current selection. When the selection is changed programmatically,
a change
event object is not dispatched.
The default value is 0.
Implementation
public function get selectedIndex():int
public function set selectedIndex(value:int):void
Related API Elements
Example ( How to use this example )
selectedIndex
property:
import fl.controls.ComboBox; import fl.controls.Slider; import fl.data.DataProvider; import fl.events.SliderEvent; var items:XML = <items> <item label="Item 1" /> <item label="Item 2" /> <item label="Item 3" /> <item label="Item 4" /> </items>; var dp:DataProvider = new DataProvider(items); var mySlider:Slider = new Slider(); mySlider.liveDragging = true; mySlider.tickInterval = 1; mySlider.snapInterval = 1; mySlider.minimum = 0; mySlider.maximum = dp.length - 1; mySlider.width = 100; mySlider.move(10, 10); mySlider.addEventListener(SliderEvent.CHANGE, changeHandler); addChild(mySlider); var myComboBox:ComboBox = new ComboBox(); myComboBox.dataProvider = dp; myComboBox.move(10, 30); addChild(myComboBox); function changeHandler(event:SliderEvent):void { myComboBox.selectedIndex = event.value; }
selectedIndex
property in a label on the Stage:
import fl.controls.ComboBox; import fl.controls.Label; var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Please select an item..."; myComboBox.addItem({label:"Item 1"}); myComboBox.addItem({label:"Item 2"}); myComboBox.addItem({label:"Item 3"}); myComboBox.addItem({label:"Item 4"}); myComboBox.width = 150; myComboBox.move(10, 10); myComboBox.addEventListener(Event.CHANGE, changeHandler); addChild(myComboBox); var myLabel:Label = new Label(); myLabel.autoSize = TextFieldAutoSize.LEFT; myLabel.text = "selectedIndex:" + myComboBox.selectedIndex; myLabel.move(myComboBox.x + myComboBox.width + 10, myComboBox.y); addChild(myLabel); function changeHandler(event:Event):void { myLabel.text = "selectedIndex:" + myComboBox.selectedIndex; }
selectedItem | property |
selectedItem:Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the value of the item that is selected in the drop-down list.
If the user enters text into the text box of an editable ComboBox component, the
selectedItem
property is undefined
. This
property has a value only if the user selects an item
or if ActionScript is used to select an item from the drop-down list.
If the ComboBox component is not editable, the value of the selectedItem
property is always valid. If there are no items in the drop-down list of
an editable ComboBox component, the value of this property is null
.
The default value is null.
Implementation
public function get selectedItem():Object
public function set selectedItem(value:Object):void
Related API Elements
Example ( How to use this example )
import fl.controls.Button; import fl.controls.ComboBox; import fl.controls.List; var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Select an item"; myComboBox.addItem({label:"Item A"}); myComboBox.addItem({label:"Item B"}); myComboBox.addItem({label:"Item C"}); myComboBox.move(10, 10); addChild(myComboBox); var myButton:Button = new Button(); myButton.label = "Copy"; myButton.move(myComboBox.x + myComboBox.width + 10, myComboBox.y); myButton.addEventListener(MouseEvent.CLICK, clickHandler); addChild(myButton); var myList:List = new List(); myList.rowCount = myList.length; myList.selectable = false; myList.move(myComboBox.x, myComboBox.y + myComboBox.height + 10); addChild(myList); function clickHandler(event:MouseEvent):void { if (myComboBox.selectedIndex > -1) { myList.addItem(myComboBox.selectedItem); myList.rowCount = myList.length; } }
import fl.controls.ComboBox; import fl.controls.Label; var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Select a user:"; myComboBox.addItem({firstName:"Jane", lastName:"Doe"}); myComboBox.addItem({firstName:"Bill", lastName:"Smith"}); myComboBox.addItem({firstName:"Tim", lastName:"Jones"}); myComboBox.labelFunction = nameLabelFunction; myComboBox.width = 120; myComboBox.move(10, 10); myComboBox.addEventListener(Event.CHANGE, changeHandler); addChild(myComboBox); var firstNameLabel:Label = new Label(); firstNameLabel.text = ""; firstNameLabel.autoSize = TextFieldAutoSize.LEFT; firstNameLabel.move(myComboBox.x, myComboBox.y + myComboBox.height); addChild(firstNameLabel); var lastNameLabel:Label = new Label(); lastNameLabel.text = ""; lastNameLabel.autoSize = TextFieldAutoSize.LEFT; lastNameLabel.move(firstNameLabel.x, firstNameLabel.y + firstNameLabel.height); addChild(lastNameLabel); function changeHandler(event:Event):void { var cb:ComboBox = event.currentTarget as ComboBox; var item:Object = cb.selectedItem; if (cb.selectedIndex > -1) { firstNameLabel.text = item.firstName; lastNameLabel.text = item.lastName; } } function nameLabelFunction(item:Object):String { return item.lastName + ", " + item.firstName; }
selectedLabel | property |
selectedLabel:String
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets the string that is displayed in the TextInput portion
of the ComboBox component. This value is calculated from the data by using
the labelField
or labelFunction
property.
Implementation
public function get selectedLabel():String
Related API Elements
Example ( How to use this example )
selectedLabel
property for a ComboBox:
import fl.controls.ComboBox; import fl.controls.Label; var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Select a user:"; myComboBox.addItem({firstName:"Jane", lastName:"Doe"}); myComboBox.addItem({firstName:"Bill", lastName:"Smith"}); myComboBox.addItem({firstName:"Tim", lastName:"Jones"}); myComboBox.labelFunction = nameLabelFunction; myComboBox.width = 120; myComboBox.move(10, 10); myComboBox.addEventListener(Event.CHANGE, changeHandler); addChild(myComboBox); var myLabel:Label = new Label(); myLabel.text = ""; myLabel.autoSize = TextFieldAutoSize.LEFT; myLabel.move(myComboBox.x, myComboBox.y + myComboBox.height); addChild(myLabel); function changeHandler(event:Event):void { var cb:ComboBox = event.currentTarget as ComboBox; myLabel.text = "selectedLabel: " + cb.selectedLabel; } function nameLabelFunction(item:Object):String { return item.lastName + ", " + item.firstName; }
text | property |
text:String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets the text that the text box contains in an editable ComboBox component. For ComboBox components that are not editable, this value is read-only.
The default value is "".
Implementation
public function get text():String
public function set text(value:String):void
Example ( How to use this example )
import fl.controls.ComboBox; import fl.controls.TextArea; import fl.events.ComponentEvent; var myComboBox:ComboBox = new ComboBox(); myComboBox.editable = true; myComboBox.addEventListener(TextEvent.TEXT_INPUT, textInputHandler); myComboBox.addEventListener(ComponentEvent.ENTER, enterHandler); myComboBox.width = 300; myComboBox.move(10, 10); addChild(myComboBox); var myTextArea:TextArea = new TextArea(); myTextArea.wordWrap = false; myTextArea.setSize(300, 200); myTextArea.move(myComboBox.x, myComboBox.y + myComboBox.height + 10); addChild(myTextArea) function textInputHandler(event:TextEvent):void { myTextArea.appendText(event.type + ":\n"); myTextArea.appendText("\t" + event.currentTarget.text + "\n"); myTextArea.appendText("\t" + event.text + "\n"); myTextArea.appendText("\n"); autoScroll(myTextArea); } function enterHandler(event:ComponentEvent):void { myTextArea.appendText(event.type + ":\n"); myTextArea.appendText("\t" + event.currentTarget.text + "\n"); myTextArea.appendText("\n"); autoScroll(myTextArea); } function autoScroll(ta:TextArea):void { ta.verticalScrollPosition = ta.maxVerticalScrollPosition; }
textField | property |
textField:fl.controls:TextInput
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets a reference to the TextInput component that the ComboBox component contains. Use this property to access and manipulate the underlying TextInput component. For example, you can use this property to change the selection of the text box or to restrict the set of characters that can be entered into it.
Implementation
public function get textField():fl.controls:TextInput
Example ( How to use this example )
import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.editable = true; myComboBox.textField.maxChars = 8; myComboBox.move(10, 10); addChild(myComboBox);
import fl.controls.ComboBox; var comicSansTF:TextFormat = new TextFormat(); comicSansTF.font = "Comic Sans MS"; var myComboBox:ComboBox = new ComboBox(); myComboBox.textField.setStyle("textFormat", comicSansTF); myComboBox.addItem({label:"Item A"}); myComboBox.addItem({label:"Item B"}); myComboBox.addItem({label:"Item C"}); myComboBox.addItem({label:"Item D"}); myComboBox.move(10, 10); addChild(myComboBox);
import fl.controls.ComboBox; import fl.data.DataProvider; var myTextFormat:TextFormat = new TextFormat(); myTextFormat.font = "Comic Sans MS"; myTextFormat.color = 0xFF0000; var fontArray:Array = Font.enumerateFonts(true); fontArray.sortOn("fontName", Array.CASEINSENSITIVE); var dp:DataProvider = new DataProvider(fontArray); var myComboBox:ComboBox = new ComboBox(); myComboBox.dataProvider = dp; myComboBox.dropdown.iconField = null; myComboBox.labelField = "fontName"; myComboBox.textField.setStyle("textFormat", myTextFormat); myComboBox.dropdown.setRendererStyle("textFormat", myTextFormat); myComboBox.width = 200; myComboBox.move(10, 10); addChild(myComboBox);
value | property |
value:String
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets the label of an item in an editable ComboBox component. For a ComboBox component that is not editable, this property gets the data that the item contains.
Implementation
public function get value():String
Example ( How to use this example )
value
property for an editable ComboBox:
import fl.controls.ComboBox; import fl.controls.Label; var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Select a user:"; myComboBox.addItem({firstName:"Jane", lastName:"Doe"}); myComboBox.addItem({firstName:"Bill", lastName:"Smith"}); myComboBox.addItem({firstName:"Tim", lastName:"Jones"}); myComboBox.labelFunction = nameLabelFunction; myComboBox.width = 120; myComboBox.move(10, 10); myComboBox.addEventListener(Event.CHANGE, changeHandler); myComboBox.editable = true; addChild(myComboBox); var myLabel:Label = new Label(); myLabel.text = ""; myLabel.autoSize = TextFieldAutoSize.LEFT; myLabel.move(myComboBox.x, myComboBox.y + myComboBox.height); addChild(myLabel); function changeHandler(event:Event):void { var cb:ComboBox = event.currentTarget as ComboBox; myLabel.text = "value: " + cb.value; } function nameLabelFunction(item:Object):String { var str:String; if (item == null) { str = myComboBox.value; } else { str = item.lastName + ", " + item.firstName; } return str; }
ComboBox | () | Constructor |
public function ComboBox()
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new ComboBox component instance.
addItem | () | method |
public function addItem(item:Object):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Appends an item to the end of the list of items.
An item should contain label
and data
properties; however, items that contain other properties can also
be added to the list. By default, the label
property of
an item is used to display the label of the row; the data
property is used to store the data of the row.
Parameters
item:Object — The item to be added to the data provider.
|
Related API Elements
addItemAt | () | method |
public function addItemAt(item:Object, index:uint):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Inserts an item into the list at the specified index location. The indices of items at or after the specified index location are incremented by 1.
Parameters
item:Object — The item to be added to the list.
| |
index:uint — The index at which to add the item.
|
Related API Elements
close | () | method |
public function close():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Closes the drop-down list.
Note: Calling this method causes the close
event to be dispatched. If the ComboBox is already closed, calling this method has no effect.
Related API Elements
Example ( How to use this example )
open()
and close()
methods:
import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item 1"}); myComboBox.addItem({label:"Item 2"}); myComboBox.addItem({label:"Item 3"}); myComboBox.move(10, 10); myComboBox.addEventListener(Event.OPEN, openHandler); myComboBox.addEventListener(Event.CLOSE, closeHandler); addChild(myComboBox); var isOpen:Boolean = false; var timer:Timer = new Timer(1000); timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); function openHandler(event:Event):void { isOpen = true; } function closeHandler(event:Event):void { isOpen = false; } function timerHandler(event:TimerEvent):void { if (isOpen) { myComboBox.close(); } else { myComboBox.open(); } }
getItemAt | () | method |
public function getItemAt(index:uint):Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the item at the specified index.
Parameters
index:uint — The index of the item to be retrieved.
|
Object — The object at the specified index location.
|
Example ( How to use this example )
getItemAt()
method to copy items from the ComboBox into a DataGrid component:
import fl.controls.ComboBox; import fl.controls.DataGrid; import fl.controls.dataGridClasses.DataGridColumn; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item 1", price:0.34}); myComboBox.addItem({label:"Item 2", price:13.19}); myComboBox.addItem({label:"item 3", price:2.96}); myComboBox.addItem({label:"Item 4", price:3.49}); myComboBox.addItem({label:"Item 5", price:1.27}); myComboBox.move(10, 10); addChild(myComboBox); var indexCol:DataGridColumn = new DataGridColumn("index"); indexCol.headerText = ""; indexCol.sortOptions = Array.NUMERIC; var labelCol:DataGridColumn = new DataGridColumn("label"); labelCol.sortOptions = Array.CASEINSENSITIVE; var priceCol:DataGridColumn = new DataGridColumn("price"); priceCol.sortOptions = Array.NUMERIC; var myDataGrid:DataGrid = new DataGrid(); myDataGrid.addColumn(indexCol); myDataGrid.addColumn(labelCol); myDataGrid.addColumn(priceCol); myDataGrid.move(10, 40); myDataGrid.rowCount = myComboBox.length; myDataGrid.width = 180; addChild(myDataGrid); var i:uint; var item:Object; for (i = 0; i < myComboBox.length; i++) { item = myComboBox.getItemAt(i); myDataGrid.addItem({index:i, label:item.label, price:item.price}); }
getStyleDefinition | () | method |
public static function getStyleDefinition():Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the default style map for the current component. The style map contains
the type that is appropriate for the component, depending on the style that
the component uses. For example, the disabledTextFormat
style
contains a value of null
or a TextFormat object.
You can use these styles and call setStyle()
on the current
component. The following code overrides the default disabledTextFormat
style on the specified component:
componentInstance.setStyle("disabledTextFormat", new TextFormat());
Object — Default styles object.
|
Related API Elements
Example ( How to use this example )
import fl.controls.*; import fl.containers.*; import fl.controls.listClasses.*; import fl.controls.dataGridClasses.*; import fl.controls.progressBarClasses.*; import fl.core.UIComponent; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem( { label: "BaseScrollPane", data:BaseScrollPane } ); dp.addItem( { label: "Button", data:Button } ); dp.addItem( { label: "CellRenderer", data:CellRenderer } ); dp.addItem( { label: "CheckBox", data:CheckBox } ); dp.addItem( { label: "ColorPicker", data:ColorPicker } ); dp.addItem( { label: "ComboBox", data:ComboBox } ); dp.addItem( { label: "DataGrid", data:DataGrid } ); dp.addItem( { label: "HeaderRenderer", data:HeaderRenderer } ); dp.addItem( { label: "ImageCell", data:ImageCell } ); dp.addItem( { label: "IndeterminateBar",data:IndeterminateBar } ); dp.addItem( { label: "Label", data:Label } ); dp.addItem( { label: "List", data:List } ); dp.addItem( { label: "NumericStepper", data:NumericStepper } ); dp.addItem( { label: "ProgressBar", data:ProgressBar } ); dp.addItem( { label: "RadioButton", data:RadioButton } ); dp.addItem( { label: "ScrollPane", data:ScrollPane } ); dp.addItem( { label: "Slider", data:Slider } ); dp.addItem( { label: "TextArea", data:TextArea } ); dp.addItem( { label: "TextInput", data:TextInput } ); dp.addItem( { label: "TileList", data:TileList } ); dp.addItem( { label: "UILoader", data:UILoader } ); dp.addItem( { label: "UIComponent", data:UIComponent } ); var cb:ComboBox = new ComboBox(); cb.move(10,10); cb.setSize(300,25); cb.prompt = "Select a component to view its styles"; cb.rowCount = 12; cb.dataProvider = dp; cb.addEventListener(Event.CHANGE, showStyleDefinition); addChild(cb); var dg:DataGrid = new DataGrid(); dg.setSize(425,300); dg.move(10,50); dg.columns = [ new DataGridColumn("StyleName"), new DataGridColumn("DefaultValue") ]; addChild(dg); function showStyleDefinition(e:Event):void { var componentClass:Class = e.target.selectedItem.data as Class; var styles:Object = componentClass["getStyleDefinition"].call(this); trace(styles.toString()); var styleData:DataProvider = new DataProvider(); for(var i:* in styles) { trace(i + " : " + styles[i]); styleData.addItem( { StyleName:i, DefaultValue:styles[i] } ); } styleData.sortOn("StyleName"); dg.dataProvider = styleData; }
itemToLabel | () | method |
public function itemToLabel(item:Object):String
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the string that the renderer displays for the given data object
based on the labelField
and labelFunction
properties.
Note: The labelField
is not used
if the labelFunction
property is set to a callback function.
Parameters
item:Object — The object to be rendered.
|
String — The string to be displayed based on the data.
|
Related API Elements
open | () | method |
public function open():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Opens the drop-down list.
Note: Calling this method causes the open
event to be dispatched. If the ComboBox component is already open, calling this method has no effect.
Related API Elements
removeAll | () | method |
public function removeAll():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Removes all items from the list.
Related API Elements
Example ( How to use this example )
removeAll()
method:
import fl.controls.Button; import fl.controls.ComboBox; import fl.controls.TextInput; var greenTF:TextFormat; var redTF:TextFormat; var myTextInput:TextInput; var addButton:Button; var myComboBox:ComboBox; var removeButton:Button; greenTF = new TextFormat(); greenTF.color = 0x006600; redTF = new TextFormat(); redTF.color = 0xFF0000; myTextInput = new TextInput(); myTextInput.maxChars = 20; myTextInput.restrict = "a-zA-Z"; myTextInput.move(10, 10); addChild(myTextInput); addButton = new Button(); addButton.label = "(+) Add"; addButton.setStyle("textFormat", greenTF); addButton.move(120, 10); addButton.addEventListener(MouseEvent.CLICK, addClickHandler); addChild(addButton); myComboBox = new ComboBox(); myComboBox.move(10, 40); addChild(myComboBox); removeButton = new Button(); removeButton.label = "(-) Remove All"; removeButton.setStyle("textFormat", redTF); removeButton.move(120, 40); removeButton.addEventListener(MouseEvent.CLICK, removeClickHandler); addChild(removeButton); function addClickHandler(event:MouseEvent):void { if (myTextInput.length > 0) { trace("adding item..."); myComboBox.addItem({label:myTextInput.text}); myComboBox.sortItemsOn("label", Array.CASEINSENSITIVE); myTextInput.text = ""; } } function removeClickHandler(event:MouseEvent):void { trace("removing all items..."); myComboBox.removeAll(); }
removeItem | () | method |
public function removeItem(item:Object):Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Removes the specified item from the list.
Parameters
item:Object — The item to be removed.
|
Object — The item that was removed.
|
Related API Elements
Example ( How to use this example )
import fl.controls.List; import fl.events.ListEvent; var myList:List = new List(); myList.addItem( { label: "Carrot" } ); myList.addItem( { label: "Turnip" } ); myList.addItem( { label: "Tomato" } ); myList.addItem( { label: "Blueberry" } ); myList.addEventListener(ListEvent.ITEM_CLICK,removeSelectedItem); addChild(myList); function removeSelectedItem(e:ListEvent):void { myList.removeItem(e.item); }
removeItemAt | () | method |
public function removeItemAt(index:uint):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Removes the item at the specified index position. The index locations of items whose indices are greater than the specified index advance in the array by 1.
This is a method of the List component that is available from an instance of the ComboBox component.
Parameters
index:uint — Index of the item to be removed.
|
Throws
RangeError — The specified index is less than 0 or greater than or
equal to the length of the data provider.
|
Related API Elements
replaceItemAt | () | method |
public function replaceItemAt(item:Object, index:uint):Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Replaces the item at the specified index location with another item. This method modifies the data provider of the List component. If the data provider is shared with other components, the data that is provided to those components is also updated.
Parameters
item:Object — The item to replace the item at the specified index location.
| |
index:uint — The index position of the item to be replaced.
|
Object — The item that was replaced.
|
Example ( How to use this example )
replaceItemAt()
method:
import fl.controls.Button; import fl.controls.ComboBox; import fl.controls.TextArea; import fl.controls.TextInput; var myComboBox:ComboBox = new ComboBox(); myComboBox.prompt = "Select a user..."; myComboBox.addItem({label:"Person 1"}); myComboBox.addItem({label:"Person 2"}); myComboBox.addItem({label:"Person 3"}); myComboBox.addItem({label:"Person 4"}); myComboBox.width = 150; myComboBox.move(10, 10); myComboBox.addEventListener(Event.CHANGE, changeHandler); addChild(myComboBox); var myTextInput:TextInput = new TextInput(); myTextInput.restrict = "a-zA-Z0-9"; myTextInput.maxChars = 12; myTextInput.move(10, 40); addChild(myTextInput) var myButton:Button = new Button(); myButton.label = "Replace item"; myButton.addEventListener(MouseEvent.CLICK, clickHandler); myButton.move(120, 40); addChild(myButton); var myTextArea:TextArea = new TextArea(); myTextArea.editable = false; myTextArea.setSize(320, 240); myTextArea.move(10, 70); addChild(myTextArea); function changeHandler(event:Event):void { myTextInput.text = myComboBox.selectedLabel; } function clickHandler(event:MouseEvent):void { var cIndex:int = myComboBox.selectedIndex; if (cIndex > -1) { var newItem:Object = {label:myTextInput.text}; var oldItem:Object = myComboBox.replaceItemAt(newItem, cIndex); myComboBox.selectedIndex = cIndex; myTextArea.appendText("[index:" + cIndex + "] old:'" + oldItem.label +"', new:'" + newItem.label + "'\n"); myTextArea.verticalScrollPosition = myTextArea.maxVerticalScrollPosition; } }
sortItems | () | method |
public function sortItems(... sortArgs):*
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sorts the elements of the current data provider. This method performs a sort based on the Unicode values of the elements. ASCII is a subset of Unicode.
Parameters
... sortArgs — The arguments against which to sort.
|
* — The return value depends on whether any parameters are passed to
this method. For more information, see the Array.sort() method.
Note that this method returns 0 when the sortArgs parameter
is set to Array.UNIQUESORT .
|
Related API Elements
Example ( How to use this example )
upperCaseSort()
, which compares two item's label
properties and returns a Boolean value depending on the order that the item should appear:
import fl.controls.ComboBox; var cb:ComboBox = new ComboBox(); cb.addItem( { label: "Mercury" } ); cb.addItem( { label: "Venus" } ); cb.addItem( { label: "Earth" } ); cb.addItem( { label: "planet" } ); cb.sortItems(upperCaseSort); addChild(cb); function upperCaseSort(a:Object, b:Object):Boolean { return a.label.toUpperCase() > b.label.toUpperCase(); }
sortItemsOn | () | method |
public function sortItemsOn(field:String, options:Object = null):*
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sorts the elements of the current data provider by one or more of its fields.
Parameters
field:String — The field on which to sort.
| |
options:Object (default = null ) — Sort arguments that are used to override the default sort behavior.
Separate two or more arguments with the bitwise OR (|) operator.
|
* — The return value depends on whether any parameters are passed to this
method. For more information, see the Array.sortOn() method.
Note that this method returns 0 when the sortOption parameter
is set to Array.UNIQUESORT .
|
Related API Elements
Example ( How to use this example )
cb
that contains four elements labeled "Apples"
, "Bananas"
, "cherries"
, and "Grapes"
:
import fl.controls.ComboBox; var cb:ComboBox = new ComboBox(); addChild(cb); // First, populate the ComboBox with the elements. cb.addItem( { label: "Bananas" } ); cb.addItem( { label: "Apples" } ); cb.addItem( { label: "cherries" } ); cb.addItem( { label: "Grapes" } ); // The following statement sorts using the order parameter set to "ASC", // and results in a sort that places "cherries" at the bottom of the list // because the sort is case-sensitive. cb.sortItemsOn("label", "ASC"); // resulting order: Apples, Bananas, Grapes, cherries // The following statement sorts using the order parameter set to "DESC", // and results in a sort that places "cherries" at the top of the list // because the sort is case-sensitive. cb.sortItemsOn("label", "DESC"); // resulting order: cherries, Grapes, Bananas, Apples // The following statement sorts using the optionsFlag parameter set to // Array.CASEINSENSITIVE. Note that an ascending sort is the default setting. cb.sortItemsOn("label", Array.CASEINSENSITIVE); // resulting order: Apples, Bananas, cherries, Grapes // The following statement sorts using the optionsFlag parameter set to // Array.CASEINSENSITIVE | Array.DESCENDING. cb.sortItemsOn("label", Array.CASEINSENSITIVE | Array.DESCENDING); // resulting order: Grapes, cherries, Bananas, Apples
sortItemsOn()
method:
import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({firstName:"Jane", lastName:"Doe"}); myComboBox.addItem({firstName:"Bill", lastName:"Smith"}); myComboBox.addItem({firstName:"Tim", lastName:"Jones"}); myComboBox.sortItemsOn("lastName", Array.CASEINSENSITIVE); myComboBox.labelFunction = nameLabelFunction; myComboBox.move(10, 10); addChild(myComboBox); function nameLabelFunction(item:Object):String { return item.lastName + ", " + item.firstName; }
change | Event |
flash.events.Event
property Event.type =
flash.events.Event.CHANGE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the user changes the selection in the ComboBox component or, if the ComboBox component is editable, each time the user enters a keystroke in the text field.
Note: While the table below specifies that the change
event bubbles, it does not bubble for the fl.controls.ComboBox control.
Event.CHANGE
constant 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. |
target | The object that has had its value modified.
The target is not always 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. |
close | Event |
flash.events.Event
property Event.type =
flash.events.Event.CLOSE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the drop-down list is dismissed for any reason.
TheEvent.CLOSE
constant defines the value of the type
property of a close
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object whose connection has been closed. |
Example ( How to use this example )
open()
and close()
methods:
import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item 1"}); myComboBox.addItem({label:"Item 2"}); myComboBox.addItem({label:"Item 3"}); myComboBox.move(10, 10); myComboBox.addEventListener(Event.OPEN, openHandler); myComboBox.addEventListener(Event.CLOSE, closeHandler); addChild(myComboBox); var isOpen:Boolean = false; var timer:Timer = new Timer(1000); timer.addEventListener(TimerEvent.TIMER, timerHandler); timer.start(); function openHandler(event:Event):void { isOpen = true; } function closeHandler(event:Event):void { isOpen = false; } function timerHandler(event:TimerEvent):void { if (isOpen) { myComboBox.close(); } else { myComboBox.open(); } }
Related API Elements
enter | Event |
fl.events.ComponentEvent
property ComponentEvent.type =
fl.events.ComponentEvent.ENTER
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched if the editable
property is set to true
and the user
presses the Enter key while typing in the editable text field.
type
property of an enter
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
currentTarget | The object that is actively processing the event object with an event listener. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
itemRollOut | Event |
fl.events.ListEvent
property ListEvent.type =
fl.events.ListEvent.ITEM_ROLL_OUT
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the user rolls the pointer off of an item in the component.
Defines the value of the
type
property of an
itemRollOut
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is
no default behavior to cancel. |
columnIndex | The zero-based index of the column that contains the renderer. |
currentTarget | The object that is actively processing the event object with an event listener. |
index | The zero-based index in the DataProvider that contains the renderer. |
item | A reference to the data that belongs to the renderer. |
rowIndex | The zero-based index of the row that contains the renderer. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Related API Elements
itemRollOver | Event |
fl.events.ListEvent
property ListEvent.type =
fl.events.ListEvent.ITEM_ROLL_OVER
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the user rolls the pointer over an item in the component.
Defines the value of the
type
property of an itemRollOver
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is
no default behavior to cancel. |
columnIndex | The zero-based index of the column that contains the renderer. |
currentTarget | The object that is actively processing the event object with an event listener. |
index | The zero-based index in the DataProvider that contains the renderer. |
item | A reference to the data that belongs to the renderer. |
rowIndex | The zero-based index of the row that contains the renderer. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
Example ( How to use this example )
import fl.controls.ComboBox; import fl.controls.TextArea; import fl.events.ListEvent; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item 1"}); myComboBox.addItem({label:"Item 2"}); myComboBox.addItem({label:"Item 3"}); myComboBox.move(10, 10); myComboBox.addEventListener(Event.OPEN, openHandler); myComboBox.addEventListener(Event.CLOSE, closeHandler); myComboBox.addEventListener(ListEvent.ITEM_ROLL_OVER, itemRollOverHandler); myComboBox.addEventListener(ListEvent.ITEM_ROLL_OUT, itemRollOutHandler); myComboBox.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); myComboBox.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); myComboBox.dropdown.addEventListener(MouseEvent.ROLL_OVER, dropdownRollOverHandler) myComboBox.dropdown.addEventListener(MouseEvent.ROLL_OUT, dropdownRollOutHandler); addChild(myComboBox); var myTextArea:TextArea = new TextArea(); myTextArea.editable = false; myTextArea.setSize(320, 240); myTextArea.move(120, 10); addChild(myTextArea); function openHandler(event:Event):void { logEvent("ComboBox open"); } function closeHandler(event:Event):void { logEvent("ComboBox close"); } function itemRollOverHandler(event:ListEvent):void { var rowIdx:uint = event.rowIndex as uint; logEvent("ComboBox itemRollOver: " + "`" + myComboBox.getItemAt(rowIdx).label + "`"); } function itemRollOutHandler(event:ListEvent):void { var rowIdx:uint = event.rowIndex as uint; logEvent("ComboBox itemRollOut: " + "`" + myComboBox.getItemAt(rowIdx).label + "`"); } function rollOverHandler(event:MouseEvent):void { logEvent("ComboBox rollOver"); myComboBox.open(); } function rollOutHandler(event:MouseEvent):void { logEvent("ComboBox rollOut"); myComboBox.close(); } function dropdownRollOverHandler(event:MouseEvent):void { logEvent("ComboBox.dropdown rollOver"); // reopen ComboBox after it gets closed by the ComboBox rollOut event myComboBox.open(); } function dropdownRollOutHandler(event:MouseEvent):void { logEvent("ComboBox.dropdown rollOut"); myComboBox.close(); } function logEvent(text:String):void { myTextArea.appendText(text + "\n"); myTextArea.verticalScrollPosition = myTextArea.maxVerticalScrollPosition; }
Related API Elements
open | Event |
flash.events.Event
property Event.type =
flash.events.Event.OPEN
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the user clicks the drop-down button to display the drop-down list. Also dispatched when the user clicks the text field, if the ComboBox component is not editable.
TheEvent.OPEN
constant defines the value of the type
property of an open
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The network object that has opened a connection. |
Example ( How to use this example )
open()
method. The dropdown menu closes after 1 second unless the user mouses over the ComboBox or its dropdown menu:
import fl.controls.Button; import fl.controls.ComboBox; var myComboBox:ComboBox = new ComboBox(); myComboBox.addItem({label:"Item 1"}); myComboBox.addItem({label:"Item 2"}); myComboBox.addItem({label:"Item 3"}); myComboBox.move(10, 10); myComboBox.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); myComboBox.dropdown.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); myComboBox.dropdown.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); addChild(myComboBox); var myButton:Button = new Button(); myButton.emphasized = true; myButton.label = "open ComboBox"; myButton.move(120, 10); myButton.addEventListener(MouseEvent.CLICK, clickHandler); addChild(myButton); var closeTimer:Timer = new Timer(1000, 1); closeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteHandler); function clickHandler(event:MouseEvent):void { myComboBox.open(); closeTimer.reset(); closeTimer.start(); } function timerCompleteHandler(event:TimerEvent):void { myComboBox.close(); } function rollOverHandler(event:MouseEvent):void { closeTimer.stop(); } function rollOutHandler(event:MouseEvent):void { myComboBox.close(); }
Related API Elements
scroll | Event |
fl.events.ScrollEvent
property ScrollEvent.type =
fl.events.ScrollEvent.SCROLL
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the user scrolls the drop-down list of the ComboBox component.
Defines the value of thetype
property of a scroll
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
currentTarget | The object that is actively processing the event object with an event listener. |
delta | 1 ; a value that indicates
how much scrolling was done.
|
direction | vertical ; the direction of the
ScrollBar. |
position | 0 ; the position of the
Scrollbar thumb after it was moved. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
- Drag a ComboBox onto the stage and name it
cb
. - Save this code as ComboBoxExample.as in the same directory as your FLA.
- Set the DocumentClass in the FLA to ComboBoxExample.
package { import flash.display.Sprite import flash.text.TextField; import flash.events.Event; import fl.controls.ComboBox; public class ComboBoxExample extends Sprite { private var tf:TextField; public function ComboBoxExample() { setupComboBox(); setupTextField(); } private function setupTextField():void { tf = new TextField(); tf.x = 180; tf.y = 15; tf.autoSize = "left"; addChild(tf); } private function setupComboBox():void { cb.setSize(150,22); cb.addItem( { label: "MasterCard", data:1 } ); cb.addItem( { label: "Visa", data:2 } ); cb.addItem( { label: "American Express", data:3 } ); cb.addEventListener(Event.CHANGE, cardSelected); } private function cardSelected(e:Event):void { tf.text = "You have selected: " tf.appendText(cb.selectedItem.label); } } }
Wed Nov 21 2018, 06:34 AM -08:00