• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Lesson 10. Custom Cursors and Buttons > Working with Sprite Bounding Areas

Working with Sprite Bounding Areas

In most applications, objects on the screen are "regularly" shaped; they're often rectangles and occasionally circles or ovals. When you begin creating more complex graphics as clickable objects, you need to consider how their visible shapes relate to what the computer considers to be their shapes and sizes—or their bounding areas. In this task, you will place an irregularly shaped object on the screen and investigate the object's clickable bounding area.

In the Cast window, double-click cast member 5, the Background cast member you created.

Double-clicking a graphic cast member brings up the Paint window that shows the selected cast member.

Using the filled rectangle tool, create another rectangle that's perpendicular to the original. Close the Paint window.

This change in the graphic is reflected in the Background cast member. You have simply changed the cast member; you haven't created a new one.

Figure .

Choose Modify > Movie > Properties. When the Property Inspector appears, set the stage color to black.

Remember that in the Property Inspector, the stage color is indicated by a paint bucket in the graphic view and by bgColor in the list view. In either view, you can click the paint chip to choose a new color. Notice that your sprite appears on the stage with its white background area, or bounding area, showing.

Figure .

Play the movie.

When you move the mouse cursor over any part of the sprite, including the white background area, the cursor changes to a hand shape.

Stop the movie. Select the sprite again in the score and set the ink effect to Background Transparent. Play the movie again.

The cursor still behaves in the same way, even though to you (or to any other user), the cursor doesn't always seem to be located over an actual object.

Stop the movie and set the ink effect of the sprite to Matte. Now try playing the movie.

This time, the cursor changes only when the mouse is over the visible area of the sprite. Similarly, clicking a sprite that is set to use Matte ink changes the cursor if the click is on the visible area. Which ink you use (Matte, Background Transparent, or another) will be determined by the effect you want to create. In the artificial situation created here, where a large amount of sprite background area is involved, it might be wise to use Matte. If you are creating an oval button, on the other hand, the bounding area will not be that much larger than the actual oval itself. In that case, having a slightly larger clickable area might be an improvement. Some of the most vehement gripes from users have to do with tiny buttons (especially tiny buttons with a large, and unclickable, title off to the side).


One handy trick that is commonly used to make complex areas clickable while still maintaining an ink effect that is appropriate is to use hidden sprites. You can create one or more sprites that combine to cover the area you want clickable and then set their ink effect to Transparent. You can then attach the behavior to the invisible sprites. The result will be, essentially, that the visible area is clickable. You can use this technique to make selected areas of a background appear clickable, for example, even though the area is actually part of a larger sprite.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint