I have 4 color squares on my stage[COLOR=Red]* red_mc, [COLOR=Red]blue_mc[/COLOR], [COLOR=Red]green_mc[/COLOR] and [COLOR=Red]yellow_mc[/COLOR]*[/COLOR]. I also have a movieClip called [COLOR=Red]floorTile[/COLOR]. What I want to do is click on any of the color squares get the pixel value and have that color change the color of the movieClip [COLOR=Red]floorTile[/COLOR]
I am trying to use the colorTransform method but I am not getting how to make it work. Any help appreciated.
blue_mc.addEventListener(MouseEvent.CLICK, getColorHandler, false, 0, true);
red_mc.addEventListener(MouseEvent.CLICK, getColorHandler, false, 0, true);
green_mc.addEventListener(MouseEvent.CLICK, getColorHandler, false, 0, true);
yellow_mc.addEventListener(MouseEvent.CLICK, getColorHandler, false, 0, true);
function getColorHandler(event:MouseEvent):void {
//red_mc is already on stage
var bmpd:BitmapData = new BitmapData(red_mc.width, red_mc.height, false);
var bmp:Bitmap = new Bitmap(bmpd);
var ct:ColorTransform = floorTile.transform.colorTransform;
ct.color = bmpd.getPixel(bmp.mouseX, bmp.mouseY);
floorTile.transform.colorTransform = ct;
}