Package | mx.controls |
Class | public class RadioButtonGroup |
Inheritance | RadioButtonGroup ![]() ![]() |
Implements | IMXMLObject |
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.RadioButtonGroup class as an alternative to this class. |
The RadioButtonGroup control defines a group of RadioButton controls that act as a single mutually exclusive control; therefore, a user can select only one RadioButton control at a time. While grouping RadioButton instances in a RadioButtonGroup is optional, a group lets you do things like set a single event handler on a group of buttons, rather than on each individual button.
The id
property is required when you use the
<mx:RadioButtonGroup>
tag to define the name
of the group.
Notice that the RadioButtonGroup control is a subclass of EventDispatcher, not UIComponent, and implements the IMXMLObject interface. All other Flex visual components are subclasses of UIComponent, which implements the IUIComponent interface. The RadioButtonGroup control has support built into the Flex compiler that allows you to use the RadioButtonGroup control as a child of a Flex container, even though it does not implement IUIComponent. All other container children must implement the IUIComponent interface.
Therefore, if you try to define a visual component as a subclass of EventDispatcher that implements the IMXMLObject interface, you will not be able to use it as the child of a container.
MXML Syntax
The <mx:RadioButtonGroup>
tag inherits all of the
tag attributes of its superclass, and adds the following tag attributes:
<mx:RadioButtonGroup Properties enabled="true|false" id="No default" labelPlacement="right|left|top|bottom" Events change="No default" itemClick="No default" />
More examples
Related API Elements
Property | Defined By | ||
---|---|---|---|
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object |
Method | Defined By | ||
---|---|---|---|
![]() | 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 | |
![]() |
Dispatches an event into the event flow. | EventDispatcher | |
![]() |
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 | |
![]() |
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | |
![]() |
Indicates whether the specified property exists and is enumerable. | Object | |
![]() |
Removes a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
Sets the availability of a dynamic property for loop operations. | Object | |
![]() |
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | |
![]() |
Returns the string representation of the specified object. | 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 |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | ||
![]() | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher |
<?xml version="1.0" encoding="utf-8"?> <!-- Simple example to demonstrate Halo RadioButtonGroup 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; import mx.events.ItemClickEvent; // Event handler function to display the selected button // in a Halo Alert control. private function handleCard(evt:ItemClickEvent):void { switch (evt.currentTarget.selectedValue) { case "AmEx": Alert.show("You selected American Express"); break; case "MC": Alert.show("You selected MasterCard"); break; case "Visa": Alert.show("You selected Visa"); break; } } ]]> </fx:Script> <fx:Declarations> <mx:RadioButtonGroup id="cardtype" itemClick="handleCard(event);"/> </fx:Declarations> <s:Panel title="Halo RadioButtonGroup Control Example" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"> <s:VGroup left="10" right="10" top="10" bottom="10"> <s:Label width="100%" color="blue" text="Select a type of credit card."/> <mx:RadioButton groupName="cardtype" id="americanExpress" value="AmEx" label="American Express" width="150" /> <mx:RadioButton groupName="cardtype" id="masterCard" value="MC" label="MasterCard" width="150" /> <mx:RadioButton groupName="cardtype" id="visa" value="Visa" label="Visa" width="150" /> </s:VGroup> </s:Panel> </s:Application>
Wed Nov 21 2018, 06:34 AM -08:00