Naslaggids voor Adobe ActionScript® 3.0 voor het Adobe® Flash®-platform
Startpagina  |  Lijst met pakketten en klassen verbergen |  Pakketten  |  Klassen  |  Nieuw  |  Index  |  Bijlagen  |  Waarom in het Engels?
Filters: Gegevens ophalen van server...
Gegevens ophalen van server...
spark.components 

RadioButtonGroup  - AS3 Flex

Pakketspark.components
Klassepublic class RadioButtonGroup
OverervingRadioButtonGroup Inheritance EventDispatcher Inheritance Object
Implementatie IMXMLObject

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

The RadioButtonGroup component defines a group of RadioButton components that act as a single mutually exclusive component; therefore, a user can select only one RadioButton component at a time. The id property is required when you use the <s:RadioButtonGroup> tag to define the group name. Any <s:RadioButton> component added to this group will have this group name.

Notice that the RadioButtonGroup component is a subclass of EventDispatcher, not UIComponent, and implements the IMXMLObject interface. All other Flex visual components implement the IVisualElement interface. The RadioButtonGroup component declaration must be contained within the <Declarations> tag since it is not assignable to IVisualElement.

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.

MXML-syntaxisexpandedMXML-syntaxis verbergen

The <s:RadioButtonGroup> tag inherits all of the tag attributes of its superclass, and adds the following tag attributes:

  <s:RadioButtonGroup
    Properties
    enabled="true"
    selectedValue="null"
    selection="null"
 
    Events
    change="No default"
    itemClick="No default"
    valueCommit="No default"
  />
  

Bekijk de voorbeelden

Meer voorbeelden

Verwante API-elementen



Openbare eigenschappen
 EigenschapGedefinieerd door
 Inheritedconstructor : Object
Verwijzing naar het klasseobject of de constructorfunctie van een bepaalde objectinstantie.
Object
  enabled : Boolean
Determines whether selection is allowed.
RadioButtonGroup
  numRadioButtons : int
[alleen-lezen] The number of RadioButtons that belong to this RadioButtonGroup.
RadioButtonGroup
  selectedValue : Object
The value property of the selected RadioButton component in the group, if it has been set, otherwise, the label property of the selected RadioButton.
RadioButtonGroup
  selection : RadioButton
Contains a reference to the currently selected RadioButton component in the group.
RadioButtonGroup
Openbare methoden
 MethodeGedefinieerd door
  
Constructor.
RadioButtonGroup
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registreert een gebeurtenislistenerobject bij een object EventDispatcher, zodat de listener een melding van een gebeurtenis ontvangt.
EventDispatcher
 Inherited
Verzendt een gebeurtenis naar de gebeurtenisstroom.
EventDispatcher
  
Returns the RadioButton component at the specified index.
RadioButtonGroup
 Inherited
Controleert of het object EventDispatcher listeners heeft geregistreerd voor een specifiek type gebeurtenis.
EventDispatcher
 Inherited
Geeft aan of voor een object een opgegeven eigenschap is gedefinieerd.
Object
  
Implementation of the IMXMLObject.initialized() method to support deferred instantiation.
RadioButtonGroup
 Inherited
Geeft aan of een instantie van de klasse Object zich in de prototypeketen van het object bevindt dat als parameter is opgegeven.
Object
 Inherited
Geeft aan of de opgegeven eigenschap bestaat en kan worden opgesomd.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Verwijdert een listener uit het object EventDispatcher.
EventDispatcher
 Inherited
Stelt de beschikbaarheid van een dynamische eigenschap voor lusbewerkingen in.
Object
 Inherited
Geeft de tekenreeksweergave van dit object weer, geformatteerd volgens de locatiespecifieke conventies.
Object
 Inherited
Retourneert een tekenreeksrepresentatie van het opgegeven object.
Object
 Inherited
Retourneert de primitieve waarde van het opgegeven object.
Object
 Inherited
Controleert of een gebeurtenislistener is geregistreerd bij dit object EventDispatcher of een van de voorouders voor het opgegeven type gebeurtenis.
EventDispatcher
Gebeurtenissen
 Gebeurtenis Overzicht Gedefinieerd door
 Inherited[uitgezonden gebeurtenis] Wordt verzonden wanneer Flash Player of de AIR-toepassing de besturingssysteemfocus krijgt en actief wordt.EventDispatcher
  Dispatched when the value of the selected RadioButton component in this group changes.RadioButtonGroup
 Inherited[uitgezonden gebeurtenis] Wordt verzonden wanneer Flash Player of de AIR-toepassing de systeemfocus verliest en inactief wordt.EventDispatcher
  Dispatched when a user selects a RadioButton component in the group.RadioButtonGroup
  Dispatched when values are changed programmatically or by user interaction.RadioButtonGroup
Eigenschapdetails

enabled

eigenschap
enabled:Boolean

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Determines whether selection is allowed. Note that the value returned only reflects the value that was explicitly set on the RadioButtonGroup and does not reflect any values explicitly set on the individual RadioButtons.

De standaardwaarde is true.



Implementatie
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void

numRadioButtons

eigenschap 
numRadioButtons:int  [alleen-lezen]

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

The number of RadioButtons that belong to this RadioButtonGroup.

De standaardwaarde is "0".

Deze eigenschap kan als de bron voor gegevensbinding worden gebruikt. Wanneer deze eigenschap wordt gewijzigd, wordt de gebeurtenis numRadioButtonsChanged verzonden.



Implementatie
    public function get numRadioButtons():int

selectedValue

eigenschap 
selectedValue:Object

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

The value property of the selected RadioButton component in the group, if it has been set, otherwise, the label property of the selected RadioButton. If no RadioButton is selected, this property is null.

If you set selectedValue, Flex selects the first RadioButton component whose value or label property matches this value.

De standaardwaarde is null.

Deze eigenschap kan als de bron voor gegevensbinding worden gebruikt. Wanneer deze eigenschap wordt gewijzigd, wordt de gebeurtenis valueCommit verzonden.



Implementatie
    public function get selectedValue():Object
    public function set selectedValue(value:Object):void

selection

eigenschap 
selection:RadioButton

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Contains a reference to the currently selected RadioButton component in the group. You can access this property in ActionScript only; it is not settable in MXML. Setting this property to null deselects the currently selected RadioButton component. A change event is not dispatched.

De standaardwaarde is null.

Deze eigenschap kan als de bron voor gegevensbinding worden gebruikt. Wanneer deze eigenschap wordt gewijzigd, wordt de gebeurtenis valueCommit verzonden.



Implementatie
    public function get selection():RadioButton
    public function set selection(value:RadioButton):void
Constructordetails

RadioButtonGroup

()Constructor
public function RadioButtonGroup(document:IFlexDisplayObject = null)

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Constructor.

Parameters
document:IFlexDisplayObject (default = null) — In simple cases where a class extends EventDispatcher, the document parameter should not be used.

Verwante API-elementen

Methodedetails

getRadioButtonAt

()methode
public function getRadioButtonAt(index:int):RadioButton

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Returns the RadioButton component at the specified index.

Parameters

index:int — The 0-based index of the RadioButton in the RadioButtonGroup.

Geretourneerde waarde
RadioButton — The specified RadioButton component if index is between 0 and numRadioButtons - 1. Returns null if the index is invalid.

Verwante API-elementen

numRadioButtons

initialized

()methode 
public function initialized(document:Object, id:String):void

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Implementation of the IMXMLObject.initialized() method to support deferred instantiation.

Parameters

document:Object — The MXML document that created this object.
 
id:String — The identifier used by document to refer to this object. If the object is a deep property on document, id is null.

Verwante API-elementen

Gebeurtenisdetails

change

Gebeurtenis
Type gebeurtenisobject: flash.events.Event
eigenschap Event.type = flash.events.Event.CHANGE

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Dispatched when the value of the selected RadioButton component in this group changes.

De constante Event.CHANGE definieert de waarde van de eigenschap type van een change-gebeurtenisobject.

Deze gebeurtenis heeft de volgende eigenschappen:

EigenschapWaarde
bubblestrue
cancelablefalse; er is geen standaardgedrag om te annuleren.
currentTargetHet object dat het gebeurtenisobject actief verwerkt met een gebeurtenislistener.
targetHet object waarvan de waarde is gewijzigd. Het target is niet altijd het object in het weergaveoverzicht dat in de gebeurtenislistener is geregistreerd. Gebruik de eigenschap currentTarget voor toegang tot het object in het weergaveoverzicht dat momenteel de gebeurtenis verwerkt.

itemClick

Gebeurtenis  
Type gebeurtenisobject: mx.events.ItemClickEvent
eigenschap ItemClickEvent.type = mx.events.ItemClickEvent.ITEM_CLICK

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Dispatched when a user selects a RadioButton component in the group. You can also set a handler for individual RadioButton components. This event is dispatched only when the user interacts with the radio buttons by using the mouse.

The ItemClickEvent.ITEM_CLICK constant defines the value of the type property of the event object for an itemClick event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
indexThe index of the navigation item that was clicked.
itemThe item in the data provider of the navigation item that was clicked.
labelThe label of the navigation item that was clicked.
relatedObjectThe child object that generated the event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.

valueCommit

Gebeurtenis  
Type gebeurtenisobject: mx.events.FlexEvent
eigenschap FlexEvent.type = mx.events.FlexEvent.VALUE_COMMIT

Taalversie: ActionScript 3.0
Productversie: Flex 4
Runtimeversies: Flash Player 10, AIR 1.5

Dispatched when values are changed programmatically or by user interaction.

Because a programmatic change triggers this event, make sure that any valueCommit event handler does not change a value that causes another valueCommit event. For example, do not change theselectedValue property or selection property in a valueCommit event handler.

The FlexEvent.VALUE_COMMIT constant defines the value of the type property of the event object for a valueCommit event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
RadioButtonGroupExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<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;
            
            private function handlePayment(event:ItemClickEvent):void {
                if (event.currentTarget.selectedValue == "check") {
                    Alert.show("You opted to pay by check."); 
                } else if (event.currentTarget.selectedValue == "credit") {
                    Alert.show("You opted to pay by credit card.");
                }
            }
        ]]>
    </fx:Script>
    
    <fx:Declarations>
        <s:RadioButtonGroup id="paymentType" itemClick="handlePayment(event);"/>
    </fx:Declarations>
    <s:VGroup paddingLeft="10" paddingTop="10">
        <s:RadioButton groupName="paymentType" 
                       id="payCheck" 
                       value="check" 
                       label="Pay by check" 
                       width="150"/>
        <s:RadioButton groupName="paymentType" 
                       id="payCredit" 
                       value="credit" 
                       label="Pay by credit card" 
                       width="150"/>
    </s:VGroup>
</s:Application>




[ X ]Waarom in het Engels?
Sommige inhoud van de Naslaggids voor ActionScript 3.0 staat in het Engels

Niet alle onderdelen van de Naslaggids voor ActionScript 3.0 zijn in alle talen vertaald. Wanneer een taalelement niet is vertaald, wordt het in het Engels weergegeven. Zo is de klasse ga.controls.HelpBox niet in elke taal vertaald. In de Nederlandse versie van de naslaggids wordt de klasse ga.controls.HelpBox bijvoorbeeld in het Engels weergegeven.