Move the mouse in and out of the polygon to register polygon collision. You can click on the Flash to add more sides to the polygon. Please note that Flash tries to be clever about rendering polygons. In Java you can get elements of a polygon that overlap but do not create holes, ugly but truthful. Flash tries to be clever about this and renders them as holes, so what appears to be a false collision when you start adding more points is actually Flash avoiding ugliness. Try to make sure your lines don't overlap and you won't have to worry about this. Download the source code.