Let’s say I have an Image in Flex, and I want to filter it such that only the Green Pixels are visible…
For example this image:
alt text http://www.LiquidFeline.com/Images/Circles.png
Would show up on the screen as:
alt text http://www.LiquidFeline.com/Images/Circles2.png
How can I accomplish this in Actionscript/Flex?
You can do this easily with the threshold method of the BitmapaData class.
Basically, make a copy of the image. Then make every pixel that fails to pass the threshold test fully transparent. The test in this case could be
pixel != your shade of green.Sample code:
With a bit more of work you could isolate ranges of colors, but for a solid color as in your case, this should do it.