 			
 			graphics.endFill();
 			
-			function anchorCompareFunctionByPolarAngle(a1:AnchorPoint, a2:AnchorPoint):Boolean
-			{
-				return a1.polarRadians.value > a2.polarRadians.value;
+			function anchorCompareFunctionByPolarAngle(a1:AnchorPoint, a2:AnchorPoint):Number
+			{
+				if(a1.polarRadians.value < a2.polarRadians.value)
+				{
+					return -1;
+				} else if (a1.polarRadians.value > a2.polarRadians.value)
+				{
+					return 1;
+				} else {
+					return 0;
+				}
 			}
 			
 		}

			}
			
			// draw the last connecting line between the last anchor and the first one.
			p1.x = anchors[anchors.length - 1].x.value; p1.y = anchors[anchors.length - 1].y.value;
			p2.x = anchors[0].x.value; p2.y = anchors[0].y.value;
			
			dataBounds.projectPointTo(p1, screenBounds);
			dataBounds.projectPointTo(p2, screenBounds);

			// convert the array of record keys into array of anchors
			for(index = 0; index < recordKeys.length; index++)
			{
				 anchor = anchors.getObject(recordKeys[index].localName) as AnchorPoint;
				
				if (recordKeys[index].keyType != ANCHOR_KEYTYPE || !anchor)
					continue;
				
				_anchors.push(anchor);
			}
			
			// sort by polar angle
			_anchors.sort(anchorCompareFunctionByPolarAngle);
			
			// draw convex hull
			for(index = 0; index < _anchors.length - 1; index++)
			{
				anchor1 = _anchors[index];
				anchor2 = _anchors[index + 1];
				p1.x = anchor1.x.value; p1.y = anchor1.y.value;
				p2.x = anchor2.x.value;p2.y = anchor2.y.value;
				dataBounds.projectPointTo(p1, screenBounds);
