• 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

Often, when you are changing the dimensions and location of a movie clip dynamically, you’ll need to know its boundaries to keep limitations on those changes. You could create a map that your viewer can move around or zoom in on for more details by setting the _x, _y, _xscale, and _yscale properties of the map. But you would also want to know where the edges of the map are so that you can make sure they are never exposed. The method you need to use is getBounds(). This method gets the minimum and maximum dimensions of the bounding box of a movie clip and puts the information in a generic object containing the properties xMin, xMax, yMin, and yMax. If you call your bounding-box object myBounds, the value of the movie clip’s left edge would be myBounds.xMin, the right edge would be myBounds.xMax, the top edge would be myBounds.yMin, and the bottom edge would be myBounds.yMax (Figure 7.50).

Figure 7.50. The xMin, xMax, yMin, and yMax properties of a boundary object refer to the edges of a movie clip whose boundaries have been retrieved.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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