< Jewel Components list

Jewel CheckBox


Available since version 0.9.4.

Class Extends
org.apache.royale.jewel.CheckBox org.apache.royale.jewel.supportClasses.button.SelectableButtonBase

Note: This component is currently only available for JavaScript.


The Jewel CheckBox consists of a selectable box that can contain a check mark and an optional label. When a user clicks or touches this control or its associated text, the CheckBox changes its state from checked to unchecked or from unchecked to checked, communicating clearly a binary condition. Checkboxes can appear alone or in groups, and can be selected and deselected individually.

Example of use

In MXML declare a CheckBox like this:


In ActionScript we can do the same in the following way:

var checkBox:CheckBox = new CheckBox();

where parent is the container where the control will be added.

Here is an example for this control:

code here

Relevant Properties and Methods

Check the Reference of org.apache.royale.jewel.CheckBox for a more detailed list of properties and methods.


PROPERTY Type Description
selected Boolean true if the check mark is displayed, false otherwise.
text String The string used as a label.
value String The associated value.



Relevant Events

The CheckBox has a change event of type org.apache.royale.events.Event. This event is dispatched when the control is selected or deselected by the user. Notice that Programmatic changes will not trigger this event.

Since this component is in essence a button, it has a click event as well. When the user clicks the control it dispatches a normal click event.

You can attach callback listeners to the change event in MXML as follows:

<j:CheckBox text="A Checkbox" value="50" change="changeHandler(event)"/>

the change event will use the changeHandler callback function you provide in ActionScript:

        private function changeHandler(event:Event):void {
            trace('CheckBox value is: ' + event.target.value, ' and selected state is: ' + event.target.selected);

When the user clicks or presses the CheckBox a message will be logged in the console showing the value and selected property values.

In ActionScript we can add an event handler this way:

var checkBox:CheckBox = new CheckBox();
checkBox.text = "A CheckBox";
checkBox.value = 50;
checkBox.addEventListener('change', changeHandler);

Relevant Beads

Unlike other components in Royale, the Jewel CheckBox does not have beads for View, Controller or Model in the JavaScript platform.

On the other hand, you can add to it other common Jewel control beads to provide more functionality. Many Jewel controls share these beads.

Common Beads

Bead Type Implementation Description
Disabled org.apache.royale.core.IBead This bead lets you disable and enable a Jewel control.

More examples

Other related Jewel components are: