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

Chapter 20. CONTROLLING VECTOR GRAPHICS > USING VECTORS FOR COLLISION DETECTION

USING VECTORS FOR COLLISION DETECTION

One of the ways in which vector shape members are different from bitmaps is that, with vector shapes, you can actually tell whether a point is inside or outside a vector shape. You can do this with bitmaps and the rollover property, but only when the ink is set to matte and the mouse is at the location you are trying to detect.

The function hitTest enables you to specify a sprite and a Stage location. The returned value is either #background, #normal, or #button. The last value can be returned by only a Flash movie, not a vector shape. However, the other two values can be used to determine whether any point is inside or outside a shape, no matter how complex that shape is.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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