设置按钮灰色 添加滤镜

//设置按钮灰色
public static function setBtnLockState(obj:InteractiveObject,b:Boolean=false):void
{
    var matrix:Array = new Array(); 
    matrix = matrix.concat([.3,.59,.11,0,0]);// red 
    matrix = matrix.concat([.3,.59,.11,0,0]);// green 
    matrix = matrix.concat([.3,.59,.11,0,0]);// blue 
    matrix = matrix.concat([0,0,0,1,0]);// alpha  
    var filter:ColorMatrixFilter = new ColorMatrixFilter(matrix); 
    obj.filters = [filter];
    obj.mouseEnabled = b;
}
//设置按钮正常色
public static function setBtnUnlockState(obj:InteractiveObject,b:Boolean=true):void
{
    obj.filters = [];
    obj.mouseEnabled = b;
}

 

//设置滤镜
private function mouseOverHandler(e:MouseEvent):void
{
    var currObj:* = e.currentTarget;
    currObj.filters = [new GlowFilter(0xFFFF32, 1, 8, 8, 4)];
}
//去除滤镜
private function mouseOutHandler(e:MouseEvent):void
{
    var currObj:* = e.currentTarget;
    currObj.filters = [];
}

 

 

posted on 2012-05-18 15:14  602147629  阅读(326)  评论(0编辑  收藏  举报