Paquete | spark.components |
Clase | public class CheckBox |
Herencia | CheckBox ToggleButtonBase ButtonBase SkinnableComponent UIComponent FlexSprite Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object |
Subclases | AXMCheckBox |
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 4 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
When a user clicks a CheckBox component or its associated text,
the CheckBox component sets its selected
property
to true
for checked, and to false
for unchecked.
To use this component in a list-based component, such as a List or DataGrid, create an item renderer. For information about creating an item renderer, see Custom Spark item renderers.
The CheckBox control has the following default characteristics:
Characteristic | Description |
---|---|
Default size | Wide enough to display the text label of the control |
Minimum size | 18 pixels wide and 18 pixels high |
Maximum size | 10000 pixels wide and 10000 pixels high |
Default skin class | spark.skins.spark.CheckBoxSkin |
The <s:CheckBox>
tag inherits all of the tag
attributes of its superclass and adds the following attributes:
<s:CheckBox Properties symbolColor="0x000000" />
Propiedad MXML predeterminadalabel
Más ejemplos
Elementos de API relacionados
Método | Definido por | ||
---|---|---|---|
CheckBox()
Constructor. | CheckBox | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra un objeto de detector de eventos con un objeto EventDispatcher, de modo que el detector reciba la notificación de un evento. | EventDispatcher | ||
Adds a non-visual style client to this component instance. | UIComponent | ||
Indica si las restricciones de seguridad provocarían la omisión de objetos de visualización de la lista devuelta al llamar al método DisplayObjectContainer.getObjectsUnderPoint() con el punto point especificado. | DisplayObjectContainer | ||
Queues a function to be called later. | UIComponent | ||
Deletes a style property from this component instance. | UIComponent | ||
Determina si el objeto de visualización especificado es un elemento secundario de la instancia de DisplayObjectContainer o la propia instancia. | DisplayObjectContainer | ||
Converts a Point object from content coordinates to global coordinates. | UIComponent | ||
Converts a Point object from content to local coordinates. | UIComponent | ||
Returns a set of properties that identify the child within
this container. | UIComponent | ||
Returns a set of properties that identify the child within
this container. | UIComponent | ||
Creates an id reference to this IUIComponent object
on its parent document object. | UIComponent | ||
Deletes the id reference to this IUIComponent object
on its parent document object. | UIComponent | ||
Returns a UITextFormat object corresponding to the text styles
for this UIComponent. | UIComponent | ||
[override]
Dispatches an event into the event flow. | UIComponent | ||
Shows or hides the focus indicator around this component. | UIComponent | ||
drawRoundRect(x:Number, y:Number, w:Number, h:Number, r:Object = null, c:Object = null, alpha:Object = null, rot:Object = null, gradient:String = null, ratios:Array = null, hole:Object = null):void
Programmatically draws a rectangle into this skin's Graphics object. | UIComponent | ||
Called by the effect instance when it stops playing on the component. | UIComponent | ||
Called by the effect instance when it starts playing on the component. | UIComponent | ||
Ends all currently playing effects on the component. | UIComponent | ||
Executes all the bindings for which the UIComponent object is the destination. | UIComponent | ||
Called after printing is complete. | UIComponent | ||
Provides the automation object at the specified index. | UIComponent | ||
Provides the automation object list . | UIComponent | ||
Devuelve un rectángulo que define el área del objeto de visualización relativo al sistema de coordenadas del objeto targetCoordinateSpace. | DisplayObject | ||
Returns the x coordinate of the element's bounds at the specified element size. | UIComponent | ||
Returns the y coordinate of the element's bounds at the specified element size. | UIComponent | ||
Devuelve el objeto de visualización secundario que sale con el nombre especificado. | DisplayObjectContainer | ||
Finds the type selectors for this UIComponent instance. | UIComponent | ||
Returns a layout constraint value, which is the same as
getting the constraint style for this component. | UIComponent | ||
A convenience method for determining whether to use the
explicit or measured height
| UIComponent | ||
A convenience method for determining whether to use the
explicit or measured width
| UIComponent | ||
Gets the object that currently has focus. | UIComponent | ||
Returns the element's layout height. | UIComponent | ||
Returns the element's layout width. | UIComponent | ||
Returns the x coordinate that the element uses to draw on screen. | UIComponent | ||
Returns the y coordinate that the element uses to draw on screen. | UIComponent | ||
Returns the transform matrix that is used to calculate the component's
layout relative to its siblings. | UIComponent | ||
Returns the layout transform Matrix3D for this element. | UIComponent | ||
Returns the element's maximum height. | UIComponent | ||
Returns the element's maximum width. | UIComponent | ||
Returns the element's minimum height. | UIComponent | ||
Returns the element's minimum width. | UIComponent | ||
Devuelve un conjunto de objetos que quedan bajo el punto especificado y son elementos secundarios (o terciarios, etc.) de esta instancia de DisplayObjectContainer. | DisplayObjectContainer | ||
Returns the element's preferred height. | UIComponent | ||
Returns the element's preferred width. | UIComponent | ||
Devuelve un rectángulo que define el límite del objeto de visualización, basado en el sistema de coordenadas definido por el parámetro targetCoordinateSpace, excluyendo los trazos en las formas. | DisplayObject | ||
Returns the item in the dataProvider that was used
by the specified Repeater to produce this Repeater, or
null if this Repeater isn't repeated. | UIComponent | ||
Gets a style property that has been set anywhere in this
component's style lookup chain. | UIComponent | ||
Converts a Point object from global to content coordinates. | UIComponent | ||
Convierte el objeto point de las coordenadas del escenario (globales) en las coordenadas del objeto de visualización (locales). | DisplayObject | ||
Convierte un punto bidimensional de las coordenadas (globales) del escenario en coordenadas (locales) de un objeto tridimensional. | DisplayObject | ||
Returns true if currentCSSState is not null. | UIComponent | ||
Comprueba si el objeto EventDispatcher tiene detectores registrados para un tipo concreto de evento. | EventDispatcher | ||
Indica si un objeto tiene definida una propiedad especificada. | Object | ||
Determines whether the specified state has been defined on this
UIComponent. | UIComponent | ||
Calcula el cuadro delimitador del objeto de visualización para ver si se solapa o corta con el cuadro delimitador del objeto de visualización obj. | DisplayObject | ||
Evalúa el objeto de visualización para comprobar si se solapa o presenta un punto de intersección con el punto especificado por los parámetros x e y. | DisplayObject | ||
Returns a box Matrix which can be passed to the
drawRoundRect() method
as the rot parameter when drawing a horizontal gradient. | UIComponent | ||
Initializes the internal structure of this component. | UIComponent | ||
Initializes various properties which keep track of repeated instances
of this component. | UIComponent | ||
Marks a component so that its updateDisplayList()
method gets called during a later screen update. | UIComponent | ||
Called by a component's items to indicate that their depth
property has changed. | UIComponent | ||
An element must call this method when its layoutDirection changes or
when its parent's layoutDirection changes. | UIComponent | ||
Marks a component so that its commitProperties()
method gets called during a later screen update. | UIComponent | ||
Marks a component so that its measure()
method gets called during a later screen update. | UIComponent | ||
Marks the component so that the new state of the skin is set
during a later screen update. | SkinnableComponent | ||
Indica si hay una instancia de la clase Object en la cadena de prototipo del objeto especificado como parámetro. | Object | ||
Convierte un punto tridimensional de las coordenadas (locales) del objeto de visualización tridimensional en un punto bidimensional en las coordenadas (globales) del escenario. | DisplayObject | ||
Converts a Point object from local to content coordinates. | UIComponent | ||
Convierte el objeto point de coordenadas del objeto de visualización (locales) en coordenadas del escenario (globales). | DisplayObject | ||
Returns true if cssState matches currentCSSState. | UIComponent | ||
Determines whether this instance is the same as, or is a subclass of,
the given type. | UIComponent | ||
Measures the specified HTML text, which can contain HTML tags such
as <font> and <b>,
assuming that it is displayed
in a single-line UITextField using a UITextFormat
determined by the styles of this UIComponent. | UIComponent | ||
Measures the specified text, assuming that it is displayed
in a single-line UITextField (or UIFTETextField) using a UITextFormat
determined by the styles of this UIComponent. | UIComponent | ||
Moves the component to a specified position within its parent. | UIComponent | ||
Propagates style changes to the children. | UIComponent | ||
Returns true if the chain of owner properties
points from child to this UIComponent. | UIComponent | ||
Called by Flex when a UIComponent object is added to or removed from a parent. | UIComponent | ||
Prepares an IFlexDisplayObject for printing. | UIComponent | ||
Indica si existe la propiedad especificada y si es enumerable. | Object | ||
Builds or rebuilds the CSS style cache for this component
and, if the recursive parameter is true,
for all descendants of this component as well. | UIComponent | ||
For each effect event, registers the EffectManager
as one of the event listeners. | UIComponent | ||
Elimina todas las instancias child de DisplayObject especificadas de la lista de elementos secundarios de la instancia de DisplayObjectContainer. | DisplayObjectContainer | ||
Elimina un detector del objeto EventDispatcher. | EventDispatcher | ||
Removes a non-visual style client from this component instance. | UIComponent | ||
Replays the specified event. | UIComponent | ||
Muestra un teclado virtual. | InteractiveObject | ||
Resolves a child by using the id provided. | UIComponent | ||
[estática]
Resumes the background processing of methods
queued by callLater(), after a call to
suspendBackgroundProcessing(). | UIComponent | ||
Sizes the object. | UIComponent | ||
Sets a layout constraint value, which is the same as
setting the constraint style for this component. | UIComponent | ||
Set the current state. | UIComponent | ||
Sets the focus to this component. | UIComponent | ||
Sets the coordinates that the element uses to draw on screen. | UIComponent | ||
Sets the layout size of the element. | UIComponent | ||
Sets the transform Matrix that is used to calculate the component's layout
size and position relative to its siblings. | UIComponent | ||
Sets the transform Matrix3D that is used to calculate the component's layout
size and position relative to its siblings. | UIComponent | ||
Establece la disponibilidad de una propiedad dinámica para operaciones de bucle. | Object | ||
Sets a style property on this component instance. | UIComponent | ||
Called when the visible property changes. | UIComponent | ||
Permite al usuario arrastrar el elemento sprite especificado. | Sprite | ||
Permite al usuario arrastrar el elemento sprite especificado en un dispositivo táctil. | Sprite | ||
Se detiene gradualmente la ejecución de línea de tiempo de todos los objetos MovieClip con raíz en este objeto. | DisplayObjectContainer | ||
Finaliza el método startDrag(). | Sprite | ||
Finaliza el método startTouchDrag() para su uso con dispositivos táctiles. | Sprite | ||
Detects changes to style properties. | UIComponent | ||
Flex calls the stylesInitialized() method when
the styles for a component are first initialized. | UIComponent | ||
[estática]
Blocks the background processing of methods
queued by callLater(),
until resumeBackgroundProcessing() is called. | UIComponent | ||
Devuelve la representación de cadena de este objeto, con formato según las convenciones específicas de configuración regional. | Object | ||
[override]
Returns a string indicating the location of this object
within the hierarchy of DisplayObjects in the Application. | FlexSprite | ||
transformAround(transformCenter:Vector3D, scale:Vector3D = null, rotation:Vector3D = null, translation:Vector3D = null, postLayoutScale:Vector3D = null, postLayoutRotation:Vector3D = null, postLayoutTranslation:Vector3D = null, invalidateLayout:Boolean = true):void
A utility method to update the rotation, scale, and translation of the
transform while keeping a particular point, specified in the component's
own coordinate space, fixed in the parent's coordinate space. | UIComponent | ||
A utility method to transform a point specified in the local
coordinates of this object to its location in the object's parent's
coordinates. | UIComponent | ||
Validates the position and size of children and draws other
visuals. | UIComponent | ||
Validate and update the properties and layout of this object
and redraw it, if necessary. | UIComponent | ||
Used by layout logic to validate the properties of a component
by calling the commitProperties() method. | UIComponent | ||
Validates the measured size of the component
If the LayoutManager.invalidateSize() method is called with
this ILayoutManagerClient, then the validateSize() method
is called when it's time to do measurements. | UIComponent | ||
Handles both the valid and invalid events from a
validator assigned to this component. | UIComponent | ||
Devuelve el valor simple del objeto especificado. | Object | ||
Returns a box Matrix which can be passed to drawRoundRect()
as the rot parameter when drawing a vertical gradient. | UIComponent | ||
Comprueba si hay registrado un detector de eventos con este objeto EventDispatcher o con cualquiera de sus ascendientes para el tipo de evento concreto. | EventDispatcher |
Los estilos son comunes o están asociados a un tema específico. Si el estilo es común, se puede utilizar con cualquier tema. Si un estilo está asociado a un tema específico, solo se puede utilizar si la aplicación usa dicho tema.
Estilo | Descripción | Definido por | ||
---|---|---|---|---|
Tipo: uint Formato: Color Herencia CSS: Sí Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 The main color for a component. | SkinnableComponent | |||
Tipo: Number Herencia CSS: No incluir Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 The alpha of the focus ring for this component. | ButtonBase | |||
Tipo: uint Formato: Color Herencia CSS: Sí Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 Color of focus ring when the component is in focus. | ButtonBase | |||
symbolColor | Tipo: uint Formato: Color Herencia CSS: Sí Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 Color of any symbol of a component. Examples include the check mark of a CheckBox or the arrow of a scroll button. El valor predeterminado es 0x000000 . | CheckBox |
Estilo | Descripción | Definido por | ||
---|---|---|---|---|
Tipo: uint Formato: Color Herencia CSS: Sí Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 The main color for a component. | SkinnableComponent | |||
Tipo: Number Herencia CSS: No incluir Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 The alpha of the focus ring for this component. | ButtonBase | |||
Tipo: uint Formato: Color Herencia CSS: Sí Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 Color of focus ring when the component is in focus. | ButtonBase | |||
iconPlacement | Tipo: String Herencia CSS: No incluir Tema: mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 Orientation of the icon in relation to the label. Valid MXML values are right , left ,
bottom , and top .
In ActionScript, you can use the following constants
to set this property:
IconPlacement.LEFT . | CheckBox | ||
Tipo: Number Formato: Length Herencia CSS: Sí Tema: mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4.5 Versiones de motor de ejecución: Flash10.1, AIR 2.0 Additional vertical space between lines of text. | ButtonBase | |||
Tipo: Number Herencia CSS: Sí Tema: mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4.5 Versiones de motor de ejecución: Flash10.1, AIR 2.0 The number of additional pixels to appear between each character. | ButtonBase | |||
symbolColor | Tipo: uint Formato: Color Herencia CSS: Sí Tema: spark, mobile Versión del lenguaje: ActionScript 3.0 Versión de producto: Flex 4 Versiones de motor de ejecución: Flash10, AIR 1.5 Color of any symbol of a component. Examples include the check mark of a CheckBox or the arrow of a scroll button. El valor predeterminado es 0x000000 . | CheckBox |
Este componente utiliza aspectos hechos a partir de partes del aspecto. No configure las partes del aspecto directamente. El aspecto de un componente define las partes del aspecto.
Para aplicar aspectos al componente, implemente un aspecto que defina los siguientes estados. Aunque se deben implementar todos los estados del aspecto, un estado de aspecto puede estar vacío. Un estado de aspecto vacío no especifica ningún cambio en el estado predeterminado del aspecto.
CheckBox | () | Información sobre |
public function CheckBox()
Versión del lenguaje: | ActionScript 3.0 |
Versión de producto: | Flex 4 |
Versiones de motor de ejecución: | Flash Player 10, AIR 1.5 |
Constructor.
<?xml version="1.0"?> <!-- Simple example to demonstrate the Spark 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[ [Bindable] public var totalCost:Number = 4.50; // This event handler adds/removes the cost of condiments to/from the total cost. private function modifyBurger(evt:MouseEvent):void { // Add 0.25 to the total cost for every condiment. Delete 0.25 for // every condiment removed. if(CheckBox(evt.target).selected) { totalCost += 0.25; } else { totalCost -= 0.25; } // Format the totalCost and then display it in a label. totalString.text = usdFormatter.format(totalCost); } ]]> </fx:Script> <fx:Declarations> <mx:CurrencyFormatter id="usdFormatter" precision="2" currencySymbol="$" decimalSeparatorFrom="." decimalSeparatorTo="." useNegativeSign="true" useThousandsSeparator="true" alignSymbol="left"/> </fx:Declarations> <s:Panel title="Spark CheckBox Control Example" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:VGroup left="10" right="10" top="10" bottom="10"> <s:Label text="Hamburger Base Price: $4.50" /> <s:Label text="Select condiments for your hamburger (0.25 each):" /> <s:CheckBox id="lettuceCB" label="Pickles" click="modifyBurger(event);"/> <s:CheckBox id="tomatoCB" label="Tomato" click="modifyBurger(event);"/> <s:CheckBox id="pickleCB" label="Lettuce" click="modifyBurger(event);"/> <s:CheckBox id="mayoCB" label="Mayonnaise" click="modifyBurger(event);"/> <mx:Spacer height="20" /> <s:HGroup> <s:Label text="Total Price: " /> <s:Label id="totalString" text="$4.50"/> </s:HGroup> </s:VGroup> </s:Panel> </s:Application>
Tue Jun 12 2018, 02:12 PM Z