(Preview)
Package | mx.controls |
Class | public class CheckBox |
Inheritance | CheckBox ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Implements | IToggleButton |
Language Version: | ActionScript 3.0 |
Product Version: | Flex 3 |
Runtime Versions: | Flash Player 9, AIR 1.1 |
![]() | Starting with Flex 4.0, Adobe recommends that you use the spark.components.CheckBox class as an alternative to this class. |
The CheckBox control consists of an optional label and a small box that can contain a check mark or not. You can place the optional text label to the left, right, top, or bottom of the CheckBox. When a user clicks a CheckBox control or its associated text, the CheckBox control changes its state from checked to unchecked or from unchecked to checked. CheckBox controls gather a set of true or false values that are not mutually exclusive.
The CheckBox control has the following default characteristics:
Characteristic | Description |
---|---|
Default size | A size large enough to hold the label |
Minimum size | 0 pixels |
Maximum size | No limit |

The <mx:CheckBox>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<mx:CheckBox Styles disabledIconColor="0x999999" iconColor="0x2B333C" />
More examples
Public Properties
Protected Properties
Public Methods
Method | Defined By | ||
---|---|---|---|
![]() |
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 | |
![]() |
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 | |
![]() |
Determines whether the specified display object is a child of the DisplayObjectContainer instance or
the instance itself. | DisplayObjectContainer | |
![]() |
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 | |
![]() |
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 | |
![]() |
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 | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
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 | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
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 | |
![]() |
Raises a virtual keyboard. | InteractiveObject | |
![]() |
Changes the position of an existing child in the display object container. | DisplayObjectContainer | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
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 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 |
Protected Methods
Styles
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.
Common Styles
Spark Theme Styles
Style | Description | Defined By | ||
---|---|---|---|---|
![]() | Type: uint Format: Color CSS Inheritance: Yes Theme: spark Language Version: ActionScript 3.0 Product Version: Flex 4 Runtime Versions: Flash10, AIR 1.5 Color applied to the button when the emphasized flag is true. | Button | ||
![]() | Type: uint Format: Color CSS Inheritance: Yes Theme: spark Language Version: ActionScript 3.0 Product Version: Flex 4 Runtime Versions: Flash10, AIR 1.5 The main color for a component. | UIComponent | ||
![]() | Type: Number Format: Length CSS Inheritance: No Theme: halo, spark Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Radius of component corners. | Button | ||
![]() | Type: uint Format: Color CSS Inheritance: Yes Theme: spark Language Version: ActionScript 3.0 Product Version: Flex 4 Runtime Versions: Flash10, AIR 1.5 Color of focus ring when the component is in focus | Button | ||
symbolColor | Type: uint Format: Color CSS Inheritance: Yes Theme: spark Language Version: ActionScript 3.0 Product Version: Flex 4 Runtime Versions: Flash10, AIR 1.5 Color of any symbol of a component. Examples include the check mark of a CheckBox or the arrow of a ScrollBar button. The default value is 0x000000 . | CheckBox |
Halo Theme Styles
Style | Description | Defined By | ||
---|---|---|---|---|
![]() | Type: uint Format: Color CSS Inheritance: No Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Color of the border. | Button | ||
![]() | Type: Number Format: Length CSS Inheritance: No Theme: halo, spark Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Radius of component corners. | Button | ||
disabledIconColor | Type: uint Format: Color CSS Inheritance: Yes Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 The color for the icon in a disabled skin. For example, this style is used by the CheckBoxIcon skin class to draw the check mark for a disabled CheckBox control, by the ComboBoxSkin class to draw the down arrow of a disabled ComboBox control, and by the DateChooserMonthArrowSkin skin class to draw the month arrow for a disabled DateChooser control. The default value depends on the component class; if it is not overridden by the class, the default value is 0x999999 .
| CheckBox | ||
![]() | Type: Array CSS Inheritance: No Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Alphas used for the background fill of controls. | Button | ||
![]() | Type: Array Format: Color CSS Inheritance: No Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Colors used to tint the background of the control. | Button | ||
![]() | Type: Array CSS Inheritance: No Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Alpha transparencies used for the highlight fill of controls. | Button | ||
iconColor | Type: uint Format: Color CSS Inheritance: Yes Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 The color for the icon in a skin. For example, this style is used by the CheckBoxIcon skin class to draw the check mark for a CheckBox control, by the ComboBoxSkin class to draw the down arrow of the ComboBox control, and by the DateChooserMonthArrowSkin skin class to draw the month arrow for the DateChooser control. The default value depends on the component class; if it is not overridden by the class, the default value is 0x111111 .
| CheckBox | ||
![]() | Type: uint Format: Color CSS Inheritance: Yes Theme: halo Language Version: ActionScript 3.0 Product Version: Flex 3 Runtime Versions: Flash9, AIR 1.1 Theme color of a component. | UIComponent |
Public Constants
Constructor Detail
Examples How to use this example
CheckBoxExample.mxml
<?xml version="1.0"?> <!-- Simple example to demonstrate the Halo CheckBox control --> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"> <fx:Script> <![CDATA[ import mx.controls.Alert; // This event handler adds and deletes items from the shopping cart. private function modifyCart():void { cartItems.text = ""; if(milkCB.selected) { cartItems.text += "milk" + "\n"; } if(eggsCB.selected) { cartItems.text += "eggs" + "\n"; } if(breadCB.selected) { cartItems.text +="bread" + "\n"; } } // This event handler opens the Halo Alert control. private function sendMessage():void { if(couponCB.selected) { Alert.show("You will receive coupons."); } else { Alert.show("You will not receive any coupons."); } } ]]> </fx:Script> <s:Panel title="Halo CheckBox Control Example" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:HGroup left="10" right="10" top="10" bottom="10"> <s:VGroup> <mx:CheckBox id="milkCB" label="milk" click="modifyCart();"/> <mx:CheckBox id="eggsCB" label="eggs" click="modifyCart();"/> <mx:CheckBox id="breadCB" label="bread" click="modifyCart();"/> </s:VGroup> <s:VGroup> <s:Label text="Items in my cart "/> <s:TextArea id="cartItems" width="300" height="50" verticalScrollPolicy="off"/> <!-- Event handler sendMessages() is used to handle event click --> <mx:CheckBox id="couponCB" label="Send me coupons for items in my cart" click="sendMessage();" selected="true" color="blue"/> </s:VGroup> </s:HGroup> </s:Panel> </s:Application>
Wed Nov 21 2018, 06:34 AM -08:00