View comments | RSS feed

RadioButton class

Inheritance MovieClip > UIObject class > UIComponent class > SimpleButton class > Button component > RadioButton

ActionScript Package Name mx.controls.RadioButton

The properties of the RadioButton class allow you at runtime to create a text label and position it in relation to the radio button. You can also assign data values to radio buttons, assign them to groups, and select them based on data value or instance name.

Setting a property of the RadioButton class with ActionScript overrides the parameter of the same name set in the Property inspector or Component inspector.

The RadioButton component uses the Focus Manager to override the default Flash Player focus rectangle and draw a custom focus rectangle with rounded corners. For information about creating focus navigation, see Creating custom focus navigation in Using Components.

Each component class has a version property, which is a class property. Class properties are available only on the class itself. The version property returns a string that indicates the version of the component. To access this property, use the following code:

trace(mx.controls.RadioButton.version);

NOTE

 

The code trace(myRadioButtonInstance.version); returns undefined.

Method summary for the RadioButton class

There are no methods exclusive to the RadioButton class.

Methods inherited from the UIObject class

The following table lists the methods the RadioButton class inherits from the UIObject class. When calling these methods from the RadioButton object, use the form RadioButtonInstance.methodName.

Method

Description

UIObject.createClassObject()

Creates an object on the specified class.

UIObject.createObject()

Creates a subobject on an object.

UIObject.destroyObject()

Destroys a component instance.

UIObject.doLater()

Calls a function when parameters have been set in the Property and Component inspectors.

UIObject.getStyle()

Gets the style property from the style declaration or object.

UIObject.invalidate()

Marks the object so it is redrawn on the next frame interval.

UIObject.move()

Moves the object to the requested position.

UIObject.redraw()

Forces validation of the object so it is drawn in the current frame.

UIObject.setSize()

Resizes the object to the requested size.

UIObject.setSkin()

Sets a skin in the object.

UIObject.setStyle()

Sets the style property on the style declaration or object.

Methods inherited from the UIComponent class

The following table lists the methods the RadioButton class inherits from the UIComponent class. When calling these methods from the RadioButton object, use the form RadioButtonInstance.methodName.

Method

Description

UIComponent.getFocus()

Returns a reference to the object that has focus.

UIComponent.setFocus()

Sets focus to the component instance.

Property summary for the RadioButton class

The following table lists properties of the RadioButton class.

Property

Description

RadioButton.data

The value associated with a radio button instance.

RadioButton.groupName

The group name for a radio button group instance or a radio button instance.

RadioButton.label

The text that appears next to a radio button.

RadioButton.labelPlacement

The orientation of the label text in relation to a radio button or a radio button group.

RadioButton.selected

Selects the radio button, and deselects the previously selected radio button. This property can be used with a RadioButton instance or a RadioButtonGroup instance.

RadioButton.selectedData

Selects the radio button with the specified data value in a radio button group.

RadioButton.selection

A reference to the currently selected radio button in a radio button group. This property can be used with a RadioButton instance or a RadioButtonGroup instance.

Properties inherited from the UIObject class

The following table lists the properties the RadioButton class inherits from the UIObject class. When accessing these properties from the RadioButton object, use the form RadioButtonInstance.propertyName.

Property

Description

UIObject.bottom

The position of the bottom edge of the object, relative to the bottom edge of its parent. Read-only.

UIObject.height

The height of the object, in pixels. Read-only.

UIObject.left

The left edge of the object, in pixels. Read-only.

UIObject.right

The position of the right edge of the object, relative to the right edge of its parent. Read-only.

UIObject.scaleX

A number indicating the scaling factor in the x direction of the object, relative to its parent.

UIObject.scaleY

A number indicating the scaling factor in the y direction of the object, relative to its parent.

UIObject.top

The position of the top edge of the object, relative to its parent. Read-only.

UIObject.visible

A Boolean value indicating whether the object is visible (true) or not (false).

UIObject.width

The width of the object, in pixels. Read-only.

UIObject.x

The left edge of the object, in pixels. Read-only.

UIObject.y

The top edge of the object, in pixels. Read-only.

Properties inherited from the UIComponent class

The following table lists the properties the RadioButton class inherits from the UIComponent class. When accessing these properties from the RadioButton object, use the form RadioButtonInstance.propertyName.

Property

Description

UIComponent.enabled

Indicates whether the component can receive focus and input.

UIComponent.tabIndex

A number indicating the tab order for a component in a document.

Properties inherited from the SimpleButton class

The following table lists the properties RadioButton class inherits from the SimpleButton class. When accessing these properties from the RadioButton object, use the form RadioButtonInstance.propertyName.

Property

Description

SimpleButton.emphasized

Indicates whether a button has the appearance of a default push button.

SimpleButton.emphasizedStyleDeclaration

The style declaration when the emphasized property is set to true.

SimpleButton.selected

A Boolean value indicating whether the button is selected (true) or not (false). The default value is false.

SimpleButton.toggle

A Boolean value indicating whether the button behaves as a toggle switch (true) or not (false). The default value is false.

Properties inherited from the Button class

The following table lists the properties the RadioButton class inherits from the Button class. When accessing these properties from the RadioButton object, use the form RadioButtonInstance.propertyName.

Property

Description

Button.icon

Specifies an icon for a button instance.

Button.label

Specifies the text that appears in a button.

Button.labelPlacement

Specifies the orientation of the label text in relation to an icon.

Event summary for the RadioButton class

The following table lists the event of the RadioButton class.

Event

Description

RadioButton.click

Triggered when the mouse button is pressed over a radio button or radio button group.

Events inherited from the UIObject class

The following table lists the events the RadioButton class inherits from the UIObject class.

Event

Description

UIObject.draw

Broadcast when an object is about to draw its graphics.

UIObject.hide

Broadcast when an object's state changes from visible to invisible.

UIObject.load

Broadcast when subobjects are being created.

UIObject.move

Broadcast when the object has moved.

UIObject.resize

Broadcast when an object has been resized.

UIObject.reveal

Broadcast when an object's state changes from invisible to visible.

UIObject.unload

Broadcast when the subobjects are being unloaded.

Events inherited from the UIComponent class

The following table lists the events the RadioButton class inherits from the UIComponent class.

Event

Description

UIComponent.focusIn

Broadcast when an object receives focus.

UIComponent.focusOut

Broadcast when an object loses focus.

UIComponent.keyDown

Broadcast when a key is pressed.

UIComponent.keyUp

Broadcast when a key is released.

Events inherited from the SimpleButton class

The following table lists the event the RadioButton class inherits from the SimpleButton class.

Event

Description

SimpleButton.click

Broadcast when the mouse is clicked (released) over a button or if the button has focus and the Spacebar is pressed.


Version 8

Comments


No screen name said on Aug 27, 2006 at 6:59 AM :
With regards to resizing a RadioButton component. The setSize() method appears not to have any affect on the component. The only way i have been able to resize said component is to use the scaleX and scaleY properties.

The problem occurs when the component recieves focus. The halo for the main component resizes but the halo for the child clip (the solid black inner circle) does not.

Is this a bug or is there something i'm doing wrong?

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00003922.html