public static function pixelArea(poly, toThrow=5000):Number { //returns the area, in pixels, of a passed-in movieclip, shape, or sprite var boundArea = poly.width * poly.height; var perc; var i = 0; var numHit=0; var numToThrow=toThrow; while (i < numToThrow) { var randX = Math.random() * poly.width; var randY = Math.random() * poly.height; var randGlobal = poly.localToGlobal(new Point(randX, randY)); if (poly.hitTestPoint(randGlobal.x, randGlobal.y, true)) { numHit++; } i++; } perc = numHit / numToThrow; //trace(perc); //trace(boundArea); return perc * boundArea; }