Maybe it's can be possible to enhance aswing to have this possibility.
In more i put you the code to do automatic grey icon for disable ,
maybe add the function too in AsWing util class ;).
Have fun :)
Axel
override public function setEnabled(b:Boolean):void
{
super.setEnabled(b);
mouseEnabled = true;
if( !b )
{
if(_fClick != null) removeEventListener(
MouseEvent.CLICK, _fClick ) ;
}
else
{
if(_fClick != null) addEventListener( MouseEvent.CLICK,
_fClick ) ;
}
}
protected function onDisabledIconLoaded( disableIcon : LoadIcon
, e : Event) : void
{
var buttonBitmap : Bitmap = GraphicUtils.bitmapOn(
disableIcon.getAsset() ) ;
setDisabledIcon( new AssetIcon( createBlackWhiteBitmap(
buttonBitmap.bitmapData )) ) ;
}
protected function createBlackWhiteBitmap( b : BitmapData ) :
Bitmap
{
var bBW : BitmapData = b.clone() ;
for( var i : uint = 0 ; i < b.width ; ++i )
for( var j : uint = 0 ; j < b.height ; ++j )
{
bBW.setPixel( i , j , GraphicUtils.getGreyColor(
bBW.getPixel(i, j ) )) ;
}
return new Bitmap( bBW ) ;
}
////
public static function getGreyColor( color : uint ) : uint
{
const red : uint = ( color >>> 16 ) & 255 ;
const green : uint = ( color >>> 8 ) & 255 ;
const blue : uint = ( color ) & 255 ;
const newColor : uint = ( red + green + blue ) / 3 ;
const alpha:uint = ( color >>> 24 ) & 255 ;
return ( alpha << 24 ) | ( newColor << 16 ) | ( newColor <<
8 ) | newColor;
}