Who wins the award for most popular pixel?

From Soulwire, a snippet that gets the average color in an image:

function averageColour( source:BitmapData ):uint {
         var red:Number = 0;
         var green:Number = 0;
         var blue:Number = 0;

         var count:Number = 0;
         var pixel:Number;

         for (var x:int = 0; x < source.width; x++)
         {
            for (var y:int = 0; y < source.height; y++)           {              pixel = source.getPixel(x, y);                     red += pixel >> 16 &amp; 0xFF;
               green += pixel >> 8 &amp; 0xFF;
               blue += pixel &amp; 0xFF;

               count++
            }
         }

         red /= count;
         green /= count;
         blue /= count;

         return red << 16 | green << 8 | blue;
      }

Careful not to pass a BitmapData with transparent pixels to this function, because it will see those as black pixels and you will get a much darker color than you wanted.

Get Adobe Flash player