Adobe Flash

Change the hit area of a button

You can specify a hit area that's a different size from the default hit area by adding a keyframe to the Hit frame of the button symbol, and then drawing a shape that defines the hit area.

1.
On the Stage, double-click the logo button that you created to view the button Timeline. The button Timeline contains the following states:

  • Up

  • Over

  • Down

  • Hit

2.
Double-click the Layer 1 name in the Timeline and rename the layer Hit Area.

3.
Select the Hit frame (Frame 4) of the Hit Area layer in the BTNLogo Timeline, and press F6 to add a keyframe.

4.
In the Tools panel, select the Rectangle tool. The stroke and fill color for the rectangle are unimportant. On the Stage, draw a rectangle that covers, as closely as possible, the logo and text.

The rectangle now defines the clickable area of the button.

5.
Click Scene 1, above the upper-left side of the Stage, to exit symbol-editing mode for the button.

6.
Select Control > Enable Simple Buttons.

7.
On the Stage, again move the pointer over the text.

The hit area changes to the shape of the rectangle that you drew.

8.
Select Control > Enable Simple Buttons to deselect that feature.

by BrainBellupdated
Advertisement: