User Guide
106 Button component
Button.icon
Availability
Flash Player 6 (6.0.79.0).
Edition
Flash MX 2004.
Usage
buttonInstance.icon
Description
Property; a string that specifies the linkage identifier of a symbol in the library to be used as an
icon for a button instance. The icon can be a movie clip symbol or a graphic symbol with an
upper left registration point. You must resize the button if the icon is too large to fit; neither
the button nor the icon resizes automatically. If an icon is larger than a button, the icon
extends over the borders of the button.
To create a custom icon, create a movie clip or graphic symbol. Select the symbol on the Stage
in symbol-editing mode and enter 0 in both the X and Y boxes in the Property inspector. In
the Library panel, select the movie clip and select Linkage from the Library pop-up menu.
Select Export for ActionScript, and enter an identifier in the Identifier text box.
The default value is an empty string (
""), which indicates that there is no icon.
Use the
labelPlacement property to set the position of the icon in relation to the button.
Example
With a button on the Stage with instance name my_button, the following code assigns the
movie clip from the Library panel with the linkage identifier
happiness to the Button
instance as an icon:
my_button.icon = "happiness";
NOTE
The icon does not appear on the Stage in Flash. You must select Control > Test Movie to
see the icon.