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

Chapter 7. Controlling the Movie Clip > Getting the Boundaries of Movie Clips

Getting the Boundaries of Movie Clips

Knowing the boundaries of your movie clip can be useful when you need to constrain a draggable movie clip to the boundaries of another movie clip. Most of the time, the constraining movie clip will be centered, so its left, right, top, and bottom limits can be defined with a combination of its X Position, Y Position, Height, and Width properties (Figure 7.46). However, when the movie clip is off-centered, you can't retrieve the limits of its bounding box using the movie clip properties. Instead, you need to use the method getBounds. This method gets the minimum and maximum dimensions of the bounding box of a movie clip and puts the information into an object containing the properties xMin, xMax, yMin, and yMax. You can use the values of those properties to constrain your draggable movie clip.

Figure 7.46. The bounding box of a centered movie clip can be defined with its Height, Width, and X and Y Position properties.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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