# Problem with databinding in Flex

**URL:** <https://forum.kirupa.com/t/problem-with-databinding-in-flex/276523>\
**Category:** flash\
**Created:** [November 30, 2008, 4:41am UTC](https://forum.kirupa.com/t/problem-with-databinding-in-flex/276523 "2008-11-30T04:41:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunetics](https://avatars.discourse-cdn.com/v4/letter/l/c2a13f/32.png) [@lunetics](https://forum.kirupa.com/u/lunetics)\
**Post date:** [November 30, 2008, 4:41am UTC](https://forum.kirupa.com/t/problem-with-databinding-in-flex/276523/1 "2008-11-30T04:41:41Z")

</div>

Hello!  
Having problem databinding in my Flex/AS3 application. I´ve an image component and a button. When pressing the button it will add a ColorMatrixFilter to the image.

[AS]  
\<mx:Script\>  
\<![CDATA[  
private function applyNegative():void  
{  
var matrix:Array = new Array();  
matrix.concat( [-1, 0, 0, 0, 255] ); // Red  
matrix.concat( [0, -1, 0, 0, 255] ); // Green  
matrix.concat( [0, 0, -1, 0, 255] ); // Blue  
matrix.concat( [0, 0, 0, 1, 0] ); // Alpha

```
applyFilter( matrix );

```

}

private function applyFilter(\_matrix:Array):void  
{  
var cmf:ColorMatrixFilter = new ColorMatrixFilter( \_matrix );  
image.filters = [cmf];  
}  
]]\>  
\</mx:Script\>

\<mx:Image x=“48” y=“45” autoLoad=“true” id=“image” scaleContent=“true” /\>  
\<mx:Button x=“10” y=“40” label=“Negative” id=“btnNegative” click=“applyNegative();” width=“86”/\>

```auto

I´ve tried data binding the button, image and parameters without success. This filter inverts the color and if I put the matrix filter array in a variable outside the applyNegative-method it will work. I´ve other image manipulation methods like contrast and it will be adjusted using a slider the same way as this. But it doesn´t work either. How can this be solved?

[Edit]
Ok, the problem was how the Matrix array was built. Instead of concatinating the values just built it using:

```

var matrix:Array = [ a, 0, 0, 0, b, // Red  
0, a, 0, 0, b, // Gren  
0, 0, a, 0, b, // Blue  
0, 0, 0, 1, 0 ]; // Alpha

```auto

```
