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.

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

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

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

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.

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

Select Control > Enable Simple Buttons.

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

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

Select Control > Enable Simple Buttons to deselect that feature.

by BrainBellupdated