View comments | RSS feed

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.

NOTE

 

The icon does not appear on the Stage in Flash. You must select Control > Test Movie to see the icon.

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";

You can also create the button and assign the icon entirely in ActionScript using the method UIObject.createClassObject() (you still must have already created an icon for the button with the linkage identifier happiness). First drag the Button component from the Components panel to the current document's library, so the component appears in the library, but not on the Stage. Then, in the first frame of the main timeline, add the following ActionScript:

this.createClassObject(mx.controls.Button, "my_button", 1, {icon: "happiness"});

See also

Button.labelPlacement


Flash CS3


Comments


wegaweb said on Nov 22, 2007 at 3:55 AM :
I need an Action script that take me to the url on clicking the button

 

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

Current page: http://livedocs.adobe.com/flash/9.0/main/00002588.html