I make some object and colored with Color Transform
. Here's my code:
function createColorItems():void
{
for (var i:int = 0; i < colorLength; i++)
{
var myColor:Object = new colorArea ;
var colorTrans:ColorTransform = new ColorTransform ;
arrColorTrans[i] = myXML.bag.color.item[i];
arrItem.push(myColor);
arrItem[i].x = 40 * i + 40;
arrItem[i].y = 300;
addChild(arrItem[i]);
colorTrans.color = Number(arrColorTrans[i]);
arrItem[i].transform.colorTransform = colorTrans;
arrItem[i].addEventListener(MouseEvent.CLICK,changeColor);
}
}
This is where i change the color.
function changeColor():void
{
trace(e.target.color);
myBox.graphics.beginFill(0x000000,0.5);
myBox.graphics.drawRect(myImg.x,myImg.y,bagImg.width,bagImg.height);
myBox.graphics.endFill();
myBox.transform.colorTransform = publicColor;
addChild(myBox);
}
what i want is when the object is clicked, the other object's color is change. I trace it with trace(e.target.color)
but it's wrong. i use publicColor
to pick the color from colorTrans
, but i don't know how to pick the color? is it possible??
Sorry for my bad grammar, please help.
You can use
getPixel
method of BitmapData. Here is a documentation. Example of using: