# Get color value of movieClip

**URL:** https://forum.kirupa.com/t/get-color-value-of-movieclip/298098
**Category:** Uncategorized
**Created:** [October 13, 2009, 5:50pm UTC](https://forum.kirupa.com/t/get-color-value-of-movieclip/298098 "2009-10-13T17:50:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)
#### Post date: [October 13, 2009, 5:50pm UTC](https://forum.kirupa.com/t/get-color-value-of-movieclip/298098/1 "2009-10-13T17:50:39Z")

</div>

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.

```auto

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;    
    
}

```
