| Inheritance | MovieClip > UIObject class > UIComponent class > DynamicButton class > DynamicRadioButton class |
Setting a property of the DynamicButton or DynamicRadioButton class with ActionScript overrides the parameter of the same name set in the Property inspector or Component inspector.
The following table lists the properties the DynamicButton and DynamicRadioButton classes inherit from the UIObject class.
| 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. |
The following table lists the properties the DynamicButton and DynamicRadioButton classes inherit from the UIComponent class.
| 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. |
The following table lists properties of the DynamicButton class.
DynamicButtonInstance.animationEffect
Property; sets the type of animation effect applied to a dynamic button. You can use this property to get or set the animation effect for a dynamic button instance. Calling this method overrides the animationEffect parameter value set during authoring. This property can be one of five values: "Circulation", "Heartbeat", "Pulsar", "Rotation" or "Vibration"; the default value is "Circulation".
The following example sets the animationEffect property of the instance dynamicButton to "Rotation":
dynamicButton.animationEffect = "Rotation";
trace(dynamicButton.animationEffect);
DynamicButtonInstance.animationIconSet
Property; specifies the set of icons (for selected and unselected state) applied to a dynamic button. You can use this property to get or set the animationIconSet parameter for a dynamic button instance. Calling this method overrides the animationIconSet parameter value set during authoring. This property can be one of five values: "set1", "set2", "set3", "set4" or "set5"; the default value is "set1".
The following example sets the animationIconSet property of the instance dynamicButton to "set3":
dynamicButton.animationIconSet = "set3";
Usage 1 (set property):
DynamicButtonInstance.setStyle("customIcons", {falseIcon: String, trueIcon: String});
Usage 2 (set property):
customIconsObject = new Object();
customIconsObject.falseIcon = String;
customIconsObject.trueIcon = String;
DynamicButtonInstance.setStyle("customIcons", customIconsObject);
Usage 3 (get property):
customIconsObject = new Object(DynamicButtonInstance.customIcons);
var1:String = customIconsObject["falseIcon"];
var2:String = customIconsObject["trueIcon"];
falseIcon A string that is the linkage identifier of a symbol in the library; this symbol is used as an icon that designates unselected state of a dynamic button. The default value is undefined.
trueIcon A string that is the linkage identifier of a symbol in the library; this symbol is used as an icon that designates selected state of a dynamic button. The default value is undefined.
Property; an object that contains the linkage identifiers of movie clips or graphic symbols in the library for custom icons. You can use this property to get or set custom icons for a dynamic button instance. Calling this method overrides the customIcons parameter value set during authoring.
The following example sets the customIcons property of the instances dynamicButton1, dynamicButton2 and dynamicButton3 to "item_false" and "item_true":
dynamicButton1.setStyle("customIcons", {falseIcon: "item_false", trueIcon: "item_true"});
dynamicButton2.setStyle("customIcons", {falseIcon: "item_false", trueIcon: "item_true"});
dynamicButton3.setStyle("customIcons", {falseIcon: "item_false", trueIcon: "item_true"});
or
customIconsObject = new Object();
customIconsObject.falseIcon = "item_false";
customIconsObject.trueIcon = "item_true";
dynamicButton1.setStyle("customIcons", customIconsObject);
dynamicButton2.setStyle("customIcons", customIconsObject);
dynamicButton3.setStyle("customIcons", customIconsObject);
You can access the customIcons property values of dynamicButton1 instance by writing the following code:
customIconsObject = new Object(dynamicButton1.customIcons);
var1 = customIconsObject["falseIcon"];
var2 = customIconsObject["trueIcon"];
trace("false icon: " + var1 + ", true icon: " + var2);
DynamicButtonInstance.embedFonts
Property; a Boolean value that indicates whether the font specified in fontFamily is an embedded font. This property must be set to true if fontFamily refers to an embedded font. Otherwise, the embedded font will not be used. If this style is set to true and fontFamily does not refer to an embedded font, no text will be displayed. The default value is false.
The following example sets the embedFonts property of the instance dynamicButton to true:
dynamicButton.embedFonts = true;
DynamicButtonInstance.fontFamily
Property; sets the font name for text of a dynamic button label. You can use this property to get or set the font name for the label of a dynamic button instance. Calling this method overrides the fontFamily parameter value set during authoring. The default value is "_sans".
The following example sets the fontFamily property of the instance dynamicButton to "Century":
dynamicButton.fontFamily = "Century";
DynamicButtonInstance.fontSize
Property; sets the point size for the font of a dynamic button label. You can use this property to get or set the font size for the label of a dynamic button instance. Calling this method overrides the fontSize parameter value set during authoring. The default value is 11.
The following example sets the fontSize property of the instance dynamicButton to 12:
dynamicButton.fontSize = 12;
DynamicButtonInstance.fontStyle
Property; sets the font style for text of a dynamic button label. You can use this property to get or set the font style for the label of a dynamic button instance. Calling this method overrides the fontStyle parameter value set during authoring. This property can be either "normal" or "italic"; the default value is "normal".
The following example sets the fontStyle property of the instance dynamicButton to "italic":
dynamicButton.fontStyle = "italic";
Usage 1 (set property):
DynamicButtonInstance.setStyle("fontNormalStyle", {[fontColor: Color[, fontWeight: String[, textDecoration: String[, backgroundColor: Color[, borderColor: Color[, fontColorDisabled: Color]]]]]]});
Usage 2 (get property):
fontNormalStyleObject = new Object(DynamicButtonInstance.fontNormalStyle);
var1:Color = fontNormalStyleObject["fontColor"];
var2:String = fontNormalStyleObject["fontWeight"];
var3:String = fontNormalStyleObject["textDecoration"];
var4:Color = fontNormalStyleObject["backgroundColor"];
var5:Color = fontNormalStyleObject["borderColor"];
var6:Color = fontNormalStyleObject["fontColorDisabled"];
fontColor The text color. The default value is 0x000000 (black).
fontWeight The font weight: either "none" or "bold". The default value is "none".
textDecoration The text decoration: either "none" or "underline". The default value is "none".
backgroundColor The color of the text field background. The default value is undefined.
borderColor The color of the text field border. The default value is undefined.
fontColorDisabled The text color when the component is disabled. The default color is undefined.
Property; an object that contains a set of styles for the label when a dynamic button is unselected. You can use this property to get or set the values of text field styles for the label of a dynamic button instance. Calling this method overrides the fontNormalStyle parameter value set during authoring.
The following example sets fontColor and textDecoration parameters of the fontNormalStyle property for the instances dynamicButton1, dynamicButton2 and dynamicButton3:
dynamicButton1.setStyle("fontNormalStyle", {fontColor: 0x336633, textDecoration: "underline"});
dynamicButton2.setStyle("fontNormalStyle", {fontColor: 0x336633, textDecoration: "underline"});
dynamicButton3.setStyle("fontNormalStyle", {fontColor: 0x336633, textDecoration: "underline"});
You can access the fontNormalStyle property values of dynamicButton1 instance by writing the following code:
fontNormalStyleObject = new Object(dynamicButton1.fontNormalStyle);
var1 = fontNormalStyleObject["fontColor"];
var2 = fontNormalStyleObject["textDecoration"];
trace("font color: " + var1 + ", text decoration: " + var2);
Usage 1 (set property):
DynamicButtonInstance.setStyle("fontOverStyle", {[fontColor: Color[, fontWeight: String[, textDecoration: String[, text: String[, backgroundColor: Color[, borderColor: Color]]]]]]});
Usage 2 (set property):
fontOverStyleObject = new Object();
fontOverStyleObject.fontColor = Color;
fontOverStyleObject.fontWeight = String;
fontOverStyleObject.textDecoration = String;
fontOverStyleObject.text = String;
fontOverStyleObject.backgroundColor = Color;
fontOverStyleObject.borderColor = Color;
DynamicButtonInstance.setStyle("fontOverStyle", fontOverStyleObject);
Usage 3 (get property):
fontOverStyleObject = new Object(DynamicButtonInstance.fontOverStyle);
var1:Color = fontOverStyleObject["fontColor"];
var2:String = fontOverStyleObject["fontWeight"];
var3:String = fontOverStyleObject["textDecoration"];
var4:String = fontOverStyleObject["text"];
var5:Color = fontOverStyleObject["backgroundColor"];
var6:Color = fontOverStyleObject["borderColor"];
fontColor The text color. The default value is 0x000000 (black).
fontWeight The font weight: either "none" or "bold". The default value is "none".
textDecoration The text decoration: either "none" or "underline". The default value is "none".
text The value of the text on the dynamic button. The default value is undefined.
backgroundColor The color of the text field background. The default value is undefined.
borderColor The color of the text field border. The default value is undefined.
Property; an object that contains a set of styles for the label when a dynamic button is rolled over. You can use this property to get or set the values of text field styles for the label of a dynamic button instance. Calling this method overrides the fontOverStyle parameter value set during authoring.
The following example sets fontColor, fontWeight, text, backgroundColor and boderColor parameters of the fontOverStyle property for the instances dynamicButton1, dynamicButton2 and dynamicButton3:
dynamicButton1.setStyle("fontOverStyle", {fontColor: 0x3366CC, fontWeight: "bold", backgroundColor: 0xFFFFFF, borderColor: 0x3366CC, text: "click"});
dynamicButton2.setStyle("fontOverStyle", {fontColor: 0x3366CC, fontWeight: "bold", backgroundColor: 0xFFFFFF, borderColor: 0x3366CC, text: "click"});
dynamicButton3.setStyle("fontOverStyle", {fontColor: 0x3366CC, fontWeight: "bold", backgroundColor: 0xFFFFFF, borderColor: 0x3366CC, text: "click"});
or
fontOverStyleObject = new Object();
fontOverStyleObject.fontColor = 0x3366CC;
fontOverStyleObject.fontWeight = "bold";
fontOverStyleObject.backgroundColor = 0xFFFFFF;
fontOverStyleObject.borderColor = 0x3366CC;
fontOverStyleObject.text = "click";
dynamicButton1.setStyle("fontOverStyle", fontOverStyleObject);
dynamicButton2.setStyle("fontOverStyle ", fontOverStyleObject);
dynamicButton3.setStyle("fontOverStyle ", fontOverStyleObject);
You can access the fontOverStyle property values of dynamicButton1 instance by writing the following code:
fontOverStyleObject = new Object(dynamicButton1.fontOverStyle);
var1 = fontOverStyleObject["fontColor"];
var2 = fontOverStyleObject["fontWeight"];
var3 = fontOverStyleObject["backgroundColor"];
var4 = fontOverStyleObject["borderColor"];
var5 = fontOverStyleObject["text"];
trace("font color: " + var1 + ", font weight: " + var2 + ", background color: " + var3 + ", border color: " + var4 + ", text: " + var5);
Usage 1 (set property):
DynamicButtonInstance.setStyle("fontSelectedStyle", {[fontColor: Color[, fontWeight: String[, textDecoration: String[, text: String[, backgroundColor: Color[, borderColor: Color]]]]]]});
Usage 2 (set property):
fontSelectedStyleObject = new Object();
fontSelectedStyleObject.fontColor = Color;
fontSelectedStyleObject.fontWeight = String;
fontSelectedStyleObject.textDecoration = String;
fontSelectedStyleObject.text = String;
fontSelectedStyleObject.backgroundColor = Color;
fontSelectedStyleObject.borderColor = Color;
DynamicButtonInstance.setStyle("fontSelectedStyle", fontSelectedStyleObject);
Usage 3 (get property):
fontSelectedStyleObject = new Object(DynamicButtonInstance.fontSelectedStyle);
var1:Color = fontSelectedStyleObject["fontColor"];
var2:String = fontSelectedStyleObject["fontWeight"];
var3:String = fontSelectedStyleObject["textDecoration"];
var4:String = fontSelectedStyleObject["text"];
var5:Color = fontSelectedStyleObject["backgroundColor"];
var6:Color = fontSelectedStyleObject["borderColor"];
fontColor The text color. The default value is 0x000000 (black).
fontWeight The font weight: either "none" or "bold". The default value is "none".
textDecoration The text decoration: either "none" or "underline". The default value is "none".
text The value of the text on the dynamic button. The default value is undefined.
backgroundColor The color of the text field background. The default value is undefined.
borderColor The color of the text field border. The default value is undefined.
Property; an object that contains a set of styles for the label when a dynamic button is selected. You can use this property to get or set the values of text field styles for the label of a dynamic button instance. Calling this method overrides the fontSelectedStyle parameter value set during authoring.
The following example sets fontColor, fontWeight, text, backgroundColor and boderColor parameters of the fontSelectedStyle property for the instances dynamicButton1, dynamicButton2 and dynamicButton3:
dynamicButton1.setStyle("fontSelectedStyle", {fontColor: 0x3366CC, fontWeight: "bold", backgroundColor: 0xFFFFFF, borderColor: 0x3366CC, text: "click"});
dynamicButton2.setStyle("fontSelectedStyle", {fontColor: 0x3366CC, fontWeight: "bold", backgroundColor: 0xFFFFFF, borderColor: 0x3366CC, text: "click"});
dynamicButton3.setStyle("fontSelectedStyle", {fontColor: 0x3366CC, fontWeight: "bold", backgroundColor: 0xFFFFFF, borderColor: 0x3366CC, text: "click"});
or
fontSelectedStyleObject = new Object();
fontSelectedStyleObject.fontColor = 0x3366CC;
fontSelectedStyleObject.fontWeight = "bold";
fontSelectedStyleObject.backgroundColor = 0xFFFFFF;
fontSelectedStyleObject.borderColor = 0x3366CC;
fontSelectedStyleObject.text = "click";
dynamicButton1.setStyle("fontSelectedStyle", fontSelectedStyleObject);
dynamicButton2.setStyle("fontSelectedStyle", fontSelectedStyleObject);
dynamicButton3.setStyle("fontSelectedStyle", fontSelectedStyleObject);
You can access the fontSelectedStyle property values of dynamicButton1 instance by writing the following code:
fontSelectedStyleObject = new Object(dynamicButton1. fontSelectedStyle);
var1 = fontSelectedStyleObject["fontColor"];
var2 = fontSelectedStyleObject["fontWeight"];
var3 = fontSelectedStyleObject["backgroundColor"];
var4 = fontSelectedStyleObject["borderColor"];
var5 = fontSelectedStyleObject["text"];
trace("font color: " + var1 + ", font weight: " + var2 + ", background color: " + var3 + ", border color: " + var4 + ", text: " + var5);
DynamicButtonInstance.iconColor
Property; sets the color of icon when a dynamic button is unselected. You can use this property to get or set the color of icon for a dynamic button instance. Calling this method overrides the iconColor parameter value set during authoring. The default value is 0xFF6600 (orange).
The following example sets the iconColor property of the instance dynamicButton to 0x0066CC:
dynamicButton.iconColor = 0x0066CC;
DynamicButtonInstance.iconColorSelected
Property; sets the color of icon when a dynamic button is selected. You can use this property to get or set the color of icon for a dynamic button instance. Calling this method overrides the iconColorSelected parameter value set during authoring. The default value is 0xFF6600 (orange).
The following example sets the iconColorSelected property of the instance dynamicButton to 0x000099:
dynamicButton.iconColorSelected = 0x000099;
DynamicButtonInstance.label
Property; specifies the text label for a dynamic button instance. You can use this property to get or set the text label for a dynamic button instance. By default, the label appears center-aligned on the dynamic button. Calling this method overrides the label authoring parameter specified in the Property inspector or the Component inspector. The default value is "DynamicButton".
The following code sets the label of the instance dynamicButton to "Bicycles":
dynamicButton.label = "Bicycles";
DynamicButtonInstance.labelPlacement
Property; sets the position of the label in relation to the icon of a dynamic button. The default value is "bottom". The following are the three possible values:
rigth The label is set to the right of the icon.
left The label is set to the left of the icon.
bottom The label is set below the icon.
The following code sets the label of the instance dynamicButton to the left of the icon. The second line of the code sends the value of the labelPlacement property to the Output panel:
dynamicButton.labelPlacement = "left";
trace(dynamicButton.labelPlacement);
DynamicButtonInstance.selected
Property; a Boolean value that sets the state of a dynamic button to selected (true) or unselected (false). You can use this property to get or set the state of a dynamic button instance. Calling this method overrides the selected parameter value set during authoring. The default value is false.
The first line of code sets the selected property of the dynamicButton instance to true. The second line of code returns the value of the selected property:
dynamicButton.selected = true;
trace(dynamicButton.selected);
Usage 1 (set property):
DynamicButtonInstance.setStyle("sound", {rollover_sound: String, release_sound: String});
Usage 2 (set property):
soundObject = new Object();
soundObject.rollover_sound = String;
soundObject.release_sound = String;
DynamicButtonInstance.setStyle("sound", soundObject);
Usage 3 (get property):
soundObject = new Object(DynamicButtonInstance.sound);
var1:String = soundObject["rollover_sound"];
var2:String = soundObject["release_sound"];
rollover_sound A string that is the linkage identifier of a sound file in the library; this parameter attaches the sound to a dynamic button when rolled over. The default value is undefined.
release_sound A string that is the linkage identifier of a sound file in the library; this parameter attaches the sound to a dynamic button when released. The default value is undefined.
Property; an object that contains the linkage identifier(s) of a sound file (sound files) in the library. This parameter attaches the sound(s) specified in the Values dialog box to a dynamic button when it is rolled over or released. The sound(s) must be in the library of the current SWF file and specified for export in the Linkage Properties dialog box. You can use this property to get or set linkages identifier(s) of sound(s) attached to a dynamic button instance. Calling this method overrides the sound parameter value set during authoring.
The following example sets the sound property values of the instance dynamicButton to "squeak" and "crash":
dynamicButton.setStyle("sound", {rollover_sound: "squeak", release_sound: "crash"});
or
soundObject = new Object();
soundObject.rollover_sound = "squeak";
soundObject.release_sound = "crash";
dynamicButton.setStyle("sound", soundObject);
You can access the sound property values of dynamicButton instance by writing the following code:
soundObject = new Object(dynamicButton.sound);
var1 = soundObject["rollover_sound"];
var2 = soundObject["release_sound"];
trace("Rollover sound: " + var1 + ", release sound: " + var2);
DynamicButtonInstance.toggle
Property; a Boolean value that turns a dynamic button into a toggle switch. If true, the state of the dynamic button changes (from selected to unselected and vice versa) when clicked. If false, the dynamic button behaves like a normal push button. Calling this method overrides the toggle parameter value set during authoring. The default value is false.
The following example sets the toggle property of the dynamicButton instance to true:
dynamicButton.toggle = true;
Usage 1 (set property):
DynamicButtonInstance.setStyle("URL", {url: String, window: String, delay: Number});
Usage 2 (set property):
URLObject = new Object();
URLObject.url = String;
URLObject.window = String;
URLObject.delay = Number;
DynamicButtonInstance.setStyle("URL", URLObject);
Usage 3 (get property):
URLObject = new Object(DynamicButtonInstance.URL);
var1:String = URLObject["url"];
var2:String = URLObject["window"];
var3:Number = URLObject["delay"];
url A string that is the URL from which to obtain the document; the default value is undefined.
window A string that specifies the window or HTML frame into which the document should load. You can enter the name of a specific window or select from the following reserved target names (the default value is "_blank"):
_self The current frame in the current window.
_blank A new window
_parent The parent of the current frame.
_top The top-level frame in the current window.
delay A number that sets the time delay, in milliseconds, between onClick event and the beginning of a specified URL loading. The default value is 500.
Property; an object that contains parameters of a document from a specific URL to be load into a window when a dynamic button is clicked. Calling this method overrides the URL parameter value set during authoring.
The following example sets the URL property values of the instance dynamicButton:
dynamicButton.setStyle("URL", {url: "http://www.macromedia.com", window: "_self", delay: 1000});
or
URLObject = new Object();
URLObject.url = "http://www.macromedia.com";
URLObject.window = "_self";
URLObject.delay = 1000;
dynamicButton.setStyle("URL", URLObject);
You can access the URL property values of dynamicButton instance by writing the following code:
URLObject = new Object(dynamicButton.URL);
var1 = URLObject["url"];
var2 = URLObject["window"];
var3 = URLObject["delay"];
trace("URL: " + var1 + ", window: " + var2 + ", delay: " + var3);
The following table lists properties of the DynamicRadioButton class.
DynamicRadioButtonInstance.groupName
DynamicRadioButtonGroup.groupName
Property; sets the group name for a dynamic radio button instance or group. You can use this property to get or set a group name for a dynamic radio button instance or for a dynamic radio button group. Calling this method overrides the groupName parameter value set during authoring. The default value is "menuGroup".
The following example sets the groupName of the instances dynamicRadioButton1, dynamicRadioButton2 and dynamicRadioButton3 to "colorChoice":
dynamicRadioButton1.groupName = "colorChoice";
dynamicRadioButton2.groupName = "colorChoice";
dynamicRadioButton3.groupName = "colorChoice";
DynamicRadioButtonInstance.selected
Property; a Boolean value that sets the state of the dynamic radio button to selected (true) and deselects the previously selected radio button, or sets the radio button to unselected (false). You can use this property to get or set the state of a dynamic radio button instance. Calling this method overrides the selected parameter value set during authoring.
The following example sets the selected property of the instance dynamicRadioButton to true:
dynamicRadioButton.selected = true;
DynamicRadioButtonInstance.selection
DynamicRadioButtonGroup.selection
Property; behaves differently depending on whether you get or set the property. If you get the property, it returns the object reference of the currently selected dynamic radio button in a dynamic radio button group. If you set the property, it selects the specified dynamic radio button (passed as an object reference) in a dynamic radio button group and deselects the previously selected dynamic radio button.
The following example selects the dynamic radio button with the instance name menu_item1 and sends its instance name to the Output panel:
menuGroup.selection = menu_item1;
trace(menuGroup.selection._name);
The following table lists the properties the DynamicRadioButton class inherits from the DynamicButton class.
|