| Pacote | mx.controls |
| Classe | classe pública RadioButtonGroup |
| Herança | RadioButtonGroup EventDispatcher Object |
| Implementos | IMXMLObject |
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, event 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.
Sintaxe MXML
Ocultar Sintaxe MXML
The <mx:RadioButtonGroup> tag inherits all of the
tag attributes of its superclass, and adds the following tag attributes:
<mx:RadioButtonGroup
Propriedades
enabled="true|false"
id="No default"
labelPlacement="right|left|top|bottom"
Eventos
change="No default"
itemClick="No default"
/>
Ver também
| Propriedade | Definido Por | ||
|---|---|---|---|
![]() | constructor : Object
Uma referência ao objeto da classe ou função construtora para uma instância determinada de um objeto.
| Object | |
| enabled : Boolean
Determines whether selection is allowed.
| RadioButtonGroup | ||
| labelPlacement : String
Position of the RadioButton label relative to the RadioButton icon
for each control in the group.
| RadioButtonGroup | ||
| numRadioButtons : int
[leitura-somente]
The number of RadioButtons that belong to this RadioButtonGroup.
| RadioButtonGroup | ||
![]() | prototype : Object
[static]
Uma referência ao objeto protótipo de uma classe ou função de objeto.
| Object | |
| selectedValue : Object
The value of the value property of the selected
RadioButton control in the group, if this has been set
to be something other than null (the default value).
| RadioButtonGroup | ||
| selection : RadioButton
Contains a reference to the currently selected
RadioButton control in the group.
| RadioButtonGroup | ||
| Método | Definido Por | ||
|---|---|---|---|
|
RadioButtonGroup(document:IFlexDisplayObject = null)
Constructor.
| RadioButtonGroup | ||
![]() |
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registra um objeto event listener com um objeto do EventDispatcher para que o listener receba notificação de um evento.
| EventDispatcher | |
![]() |
Despacha um evento no fluxo de eventos.
| EventDispatcher | |
|
Returns the RadioButton control at the specified index.
| RadioButtonGroup | ||
![]() |
Verifica se o objeto do EventDispatcher tem listeners registrados para um tipo determinado de evento.
| EventDispatcher | |
![]() |
Indica se um objeto tem uma propriedade específica definida.
| Object | |
|
Implementation of the IMXMLObject.initialized() method
to support deferred instantiation.
| RadioButtonGroup | ||
![]() |
Indica se uma instância da classe Object está na corrente do protótipo do objeto determinado como parâmetro.
| Object | |
![]() |
Indica se a propriedade especificada existe e se é enumerável.
| Object | |
![]() |
Remove um listener do objeto do EventDispatcher.
| EventDispatcher | |
![]() |
Determina a disponibilidade de uma propriedade dinâmica para operações em loop.
| Object | |
![]() |
Retorna a representação em string de um objeto determinado.
| Object | |
![]() |
Retorna o valor primitivo de um objeto específico.
| Object | |
![]() |
Verifica se um event listener está registrado com esse objeto do EventDispatcher ou qualquer um de seus parents para o determinado tipo de evento.
| EventDispatcher | |
| Evento | Sumário | Definido Por | ||
|---|---|---|---|---|
![]() | Despachado quando o Flash Player ou um aplicativo AIR obtém foco do sistema operacional e se torna ativo. | EventDispatcher | ||
| Dispatched when the value of the selected RadioButton control in this group changes. | RadioButtonGroup | |||
![]() | Despachado quando o Flash Player ou um aplicativo AIR perde o foco do sistema operacional e está se tornando inativo. | EventDispatcher | ||
| Dispatched when a user selects a RadioButton control in the group. | RadioButtonGroup | |||
| enabled | propriedade |
enabled:Boolean [ler-escrever] Determines whether selection is allowed.
O valor padrão é true.
Essa propriedade pode ser usada como a fonte para a união de dados.
public function get enabled():Boolean
public function set enabled(value:Boolean):void
| labelPlacement | propriedade |
labelPlacement:String [ler-escrever] Position of the RadioButton label relative to the RadioButton icon for each control in the group. You can override this setting for the individual controls.
Valid values in MXML are "right", "left",
"bottom", and "top".
Em ActionScript, você usa as seguintes constantes para ajustar essa propriedade:
ButtonLabelPlacement.RIGHT, ButtonLabelPlacement.LEFT,
ButtonLabelPlacement.BOTTOM, and ButtonLabelPlacement.TOP.
O valor padrão é "right".
Essa propriedade pode ser usada como a fonte para a união de dados.
public function get labelPlacement():String
public function set labelPlacement(value:String):void
| numRadioButtons | propriedade |
numRadioButtons:int [leitura-somente] The number of RadioButtons that belong to this RadioButtonGroup.
O valor padrão é "undefined".
Essa propriedade pode ser usada como a fonte para a união de dados.
public function get numRadioButtons():int
| selectedValue | propriedade |
selectedValue:Object [ler-escrever]
The value of the value property of the selected
RadioButton control in the group, if this has been set
to be something other than null (the default value).
Otherwise, selectedValue is the value of the
label property of the selected RadioButton.
If no RadioButton is selected, this property is null.
If you set selectedValue, Flex selects the
RadioButton control whose value or
label property matches this value.
O valor padrão é null.
Essa propriedade pode ser usada como a fonte para a união de dados.
public function get selectedValue():Object
public function set selectedValue(value:Object):void
| selection | propriedade |
selection:RadioButton [ler-escrever]
Contains a reference to the currently selected
RadioButton control in the group.
You can access the property in ActionScript only;
it is not settable in MXML.
Setting this property to null deselects the currently selected RadioButton control.
O valor padrão é null.
Essa propriedade pode ser usada como a fonte para a união de dados.
public function get selection():RadioButton
public function set selection(value:RadioButton):void
| RadioButtonGroup | () | Construtor |
public function RadioButtonGroup(document:IFlexDisplayObject = null)
Constructor.
Parâmetrosdocument:IFlexDisplayObject (default = null) — In simple cases where a class extends EventDispatcher,
the document parameter should not be used.
|
Ver também
| getRadioButtonAt | () | método |
public function getRadioButtonAt(index:int):RadioButton
Returns the RadioButton control at the specified index.
Parâmetros
index:int — The index of the RadioButton control in the
RadioButtonGroup control, where the index of the first control is 0.
|
RadioButton — The specified RadioButton control.
|
| initialized | () | método |
public function initialized(document:Object, id:String):void
Implementation of the IMXMLObject.initialized() method
to support deferred instantiation.
Parâmetros
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.
|
Ver também
| change | Evento |
flash.events.Event
flash.events.Event.CHANGE
Dispatched when the value of the selected RadioButton control in this group changes.
A constante Event.CHANGE define o valor da propriedade de tipo de um objeto de evento change.This event has the following properties:
| Propriedade | Valor |
|---|---|
bubbles | true |
cancelable | false; there is no default behavior to cancel. |
currentTarget | O objeto que está ativamente processando o objeto Event com um event listener. |
target | The object that has had its value modified.
The target is not always the object in the display list
that registered the event listener. Use the currentTarget
property to access the object in the display list that is currently processing the event. |
| itemClick | Evento |
mx.events.ItemClickEvent
mx.events.ItemClickEvent.ITEM_CLICK
Dispatched when a user selects a RadioButton control in the group. You can also set a handler for individual RadioButton controls.
TheItemClickEvent.ITEM_CLICK constant defines the value of the
type property of the event object for an itemClick event.
As propriedades do objeto de evento tem os seguintes valores:
| Propriedade | Valor |
|---|---|
bubbles | false |
cancelable | false |
currentTarget | O Object que define o event listener que cuida do evento. Por exemplo, se você usar o myButton.addEventListener() para registrar um event listener, myButton é o valor do 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 | O Object que despachou o evento; nem sempre é o Object que escuta pelo evento. Use a propriedade currentTarget para sempre acessar o Objeto que faz a escuta pelo evento. |
<?xml version="1.0"?>
<!-- Simple example to demonstrate RadioButtonGroup control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.ItemClickEvent;
// Event handler function to display the selected button
// in an Alert control.
private function handleCard(event:ItemClickEvent):void {
if (event.currentTarget.selectedValue == "AmEx") {
Alert.show("You selected American Express")
}
else {
if (event.currentTarget.selectedValue == "MC") {
Alert.show("You selected MasterCard")
}
else {
Alert.show("You selected Visa")
}
}
}
]]>
</mx:Script>
<mx:Panel title="RadioButtonGroup Control Example" height="75%" width="75%"
paddingTop="10" paddingLeft="10">
<mx:Label width="100%" color="blue"
text="Select a type of credit card."/>
<mx:RadioButtonGroup id="cardtype" itemClick="handleCard(event);"/>
<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" />
</mx:Panel>
</mx:Application>