| Pakiet | spark.components |
| Klasa | public class RadioButtonGroup |
| Dziedziczenie | RadioButtonGroup EventDispatcher Object |
| Implementuje | IMXMLObject |
| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
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.
Składnia MXML
Ukryj składnię MXMLThe <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"
/>
Powiązane elementy interfejsu API
| Właściwość | Zdefiniowane przez | ||
|---|---|---|---|
![]() | constructor : Object
Odwołanie do obiektu klasy lub funkcji konstruktora, dotyczące danej instancji obiektu. | Object | |
| enabled : Boolean
Determines whether selection is allowed. | RadioButtonGroup | ||
| numRadioButtons : int [tylko do odczytu]
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 | ||
| Metoda | Zdefiniowane przez | ||
|---|---|---|---|
RadioButtonGroup(document:IFlexDisplayObject = null)
Constructor. | RadioButtonGroup | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Rejestruje obiekt detektora zdarzeń w obiekcie EventDispatcher, dzięki czemu detektor będzie otrzymywał powiadomienia o zdarzeniu. | EventDispatcher | |
![]() |
Wywołuje zdarzenie, tj. kieruje je do przepływu zdarzeń. | EventDispatcher | |
Returns the RadioButton component at the specified index. | RadioButtonGroup | ||
![]() |
Sprawdza, czy obiekt EventDispatcher zawiera jakiekolwiek detektory zarejestrowane dla konkretnego typu zdarzeń. | EventDispatcher | |
![]() |
Wskazuje, czy dla obiektu zdefiniowano określoną właściwość. | Object | |
Implementation of the IMXMLObject.initialized() method
to support deferred instantiation. | RadioButtonGroup | ||
![]() |
Wskazuje, czy instancja klasy Object należy do łańcucha prototypów obiektu określonego jako parametr. | Object | |
![]() |
Wskazuje, czy określona właściwość istnieje i jest przeliczalna. | Object | |
![]() |
Usuwa detektor z obiektu EventDispatcher. | EventDispatcher | |
![]() |
Ustawia dostępność właściwości dynamicznej używanej w pętlach. | Object | |
![]() |
Zwraca ciąg reprezentujący obiekt — sformatowany zgodnie z konwencjami właściwymi dla ustawień regionalnych. | Object | |
![]() |
Zwraca ciąg reprezentujący określony obiekt. | Object | |
![]() |
Zwraca pierwotną wartość dla określonego obiektu. | Object | |
![]() |
Sprawdza, czy detektor zdarzeń określonego typu jest zarejestrowany w tym obiekcie EventDispatcher lub jego elementach macierzystych. | EventDispatcher | |
| Zdarzenie | Podsumowanie | Zdefiniowane przez | ||
|---|---|---|---|---|
![]() | [zdarzenie broadcast] Wywoływane, gdy program Flash Player lub aplikacja środowiska wykonawczego AIR uzyskuje fokus w systemie operacyjnym i przechodzi w stan aktywny. | EventDispatcher | ||
| Dispatched when the value of the selected RadioButton component in this group changes. | RadioButtonGroup | |||
![]() | [zdarzenie broadcast] Wywoływane, gdy program Flash Player lub aplikacja AIR traci fokus w systemie operacyjnym i przechodzi w stan nieaktywny. | EventDispatcher | ||
| Dispatched when a user selects a RadioButton component in the group. | RadioButtonGroup | |||
| Dispatched when values are changed programmatically or by user interaction. | RadioButtonGroup | |||
enabled | właściwość |
enabled:Boolean| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | 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.
Wartością domyślną jest true.
Implementacja
public function get enabled():Boolean public function set enabled(value:Boolean):voidnumRadioButtons | właściwość |
numRadioButtons:int [tylko do odczytu] | Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
The number of RadioButtons that belong to this RadioButtonGroup.
Wartością domyślną jest "0".
Ta właściwość może być używana jako źródło dla tworzenia powiązań danych. Jeśli ta właściwość zostanie zmodyfikowana, zostanie wywołane zdarzenie numRadioButtonsChanged .
Implementacja
public function get numRadioButtons():intselectedValue | właściwość |
selectedValue:Object| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | 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.
Wartością domyślną jest null.
Ta właściwość może być używana jako źródło dla tworzenia powiązań danych. Jeśli ta właściwość zostanie zmodyfikowana, zostanie wywołane zdarzenie valueCommit .
Implementacja
public function get selectedValue():Object public function set selectedValue(value:Object):voidselection | właściwość |
selection:RadioButton| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | 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.
Wartością domyślną jest null.
Ta właściwość może być używana jako źródło dla tworzenia powiązań danych. Jeśli ta właściwość zostanie zmodyfikowana, zostanie wywołane zdarzenie valueCommit .
Implementacja
public function get selection():RadioButton public function set selection(value:RadioButton):voidRadioButtonGroup | () | Konstruktor |
public function RadioButtonGroup(document:IFlexDisplayObject = null)| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
Constructor.
Parametrydocument:IFlexDisplayObject (default = null) — In simple cases where a class extends EventDispatcher,
the document parameter should not be used.
|
Powiązane elementy interfejsu API
getRadioButtonAt | () | metoda |
public function getRadioButtonAt(index:int):RadioButton| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
Returns the RadioButton component at the specified index.
Parametry
index:int — The 0-based index of the RadioButton in the
RadioButtonGroup.
|
RadioButton — The specified RadioButton component if index is between
0 and numRadioButtons - 1. Returns
null if the index is invalid.
|
Powiązane elementy interfejsu API
initialized | () | metoda |
public function initialized(document:Object, id:String):void| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
Implementation of the IMXMLObject.initialized() method
to support deferred instantiation.
Parametry
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.
|
Powiązane elementy interfejsu API
change | Zdarzenie |
flash.events.Eventwłaściwość Event.type =
flash.events.Event.CHANGE| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | Flash Player 10, AIR 1.5 |
Dispatched when the value of the selected RadioButton component in this group changes.
StałaEvent.CHANGE definiuje wartość właściwości type obiektu zdarzenia change.
To zdarzenie ma następujące właściwości:
| Właściwość | Wartość |
|---|---|
bubbles | true |
cancelable | false; nie ma domyślnego zachowania, które można byłoby anulować. |
currentTarget | Obiekt przetwarzający aktywnie obiekt Event za pomocą detektora zdarzeń. |
target | Wartość obiektu została zmodyfikowana. Obiekt target nie zawsze jest obiektem na liście wyświetlania, która zarejestrowała detektor zdarzeń. Właściwość currentTarget umożliwia uzyskanie dostępu do obiektu na liście wyświetlania, który obecnie przetwarza zdarzenie. |
itemClick | Zdarzenie |
mx.events.ItemClickEventwłaściwość ItemClickEvent.type =
mx.events.ItemClickEvent.ITEM_CLICK| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | 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.
TheItemClickEvent.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:
| Property | Value |
|---|---|
bubbles | false |
cancelable | false |
currentTarget | The 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. |
index | The index of the navigation item that was clicked. |
item | The item in the data provider of the navigation item that was clicked. |
label | The label of the navigation item that was clicked. |
relatedObject | The child object that generated the event. |
target | The 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 | Zdarzenie |
mx.events.FlexEventwłaściwość FlexEvent.type =
mx.events.FlexEvent.VALUE_COMMIT| Wersja języka: | ActionScript 3.0 |
| Wersja produktu: | Flex 4 |
| Wersje środowiska wykonawczego: | 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.
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:
| Property | Value |
|---|---|
bubbles | false |
cancelable | false |
currentTarget | The 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. |
target | The 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. |
<?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>
Tue Jun 12 2018, 12:06 PM Z
Pokaż składnię MXML