title: Detect coordinates within a shape
body: <p>Theres 2 parts to my problem and they are related. I have a weird shape on my interface illustrated below, I am trying to randomly spawn MovieClips within its' boundaries but I am having some trouble finding a good way to do it.<a href="https://i.stack.imgur.com/9PVuv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9PVuv.jpg" alt="WeirdShape"></a></p>
  
  <p><strong>Question 1</strong>: I can run an If condition to check with bitMapData.hitTest to see if the MovieClip has randomly spawn within this shape, if it doesn't simply retry with a new set of random coordinates. However, is there a better way? Like a way to only take into account coordinates within the shape? There will be plenty of MC spawned at one go so I am hoping to lessen the load, or at least find an efficient way to do this calculation.</p>
  
  <p><strong>Question 2</strong>: The MovieClips spawned within this shape will eventually have collision detection mechanics that will repel itself when interacted with. <em>Is there a way to contain them within this shape via some kind of boundary detection?</em></p>
  
  <p>If it was a square, we could easily have contained them with a quick check on all 4 edges, but not with this shape. Currently I am thinking of using bitMapData.hitTest again to detect for out-of-bounds after being repelled, but how do I know which Point() is the nearest 'edge' of this shape to return the MC to?</p>