--- In flexcoders@yahoogroups.com, "littleazar" <[EMAIL PROTECTED]> 
wrote:
>
> can anybody help me with the getpixel property to get the color of 
a 
> certain pixel(cursor) maybe even a sample or some code.id really 
> appreciate it. i will be using it for a hot spot. thanks
>

something like this (totally untested, typed directly in mail, and 
you'll need to adjust):


private function getColor(e:MouseEvent):String{
   var myWidth:int = somewidth;
   var myHeight:int = someheight;
   var translateMatrix:Matrix = new Matrix();
   translateMatrix.translate(0, 0);
   var myColorTransform:ColorTransform = new ColorTransform(1, 1, 1, 
1, 0, 0, 0, 0);
   var blendMode:String = "normal";
        
   var myRectangle:Rectangle = new Rectangle(0, 0, myWidth, myHeight);

   myBitmap = new BitmapData(myWidth,myHeight,true,0x00FFFFFF);
   myBitmap.draw(someMovieClip, translateMatrix, myColorTransform, 
blendMode, myRectangle);
   return myBitmap.getPixel(e.stageX, e.stageY).toString(16); // 
returns hex color - see reference for other color stuff
                
}

Reply via email to