图片节点实现单选的效果

 <mx:Script>
  <![CDATA[
   import mx.controls.Alert;
   import flash.filters.DropShadowFilter;

   //创建阴影滤镜
   private function getDropShadowFilter():DropShadowFilter
   {
    var color:Number=0x979590;
    var angle:Number=60;
    var alpha:Number=1.0;
    var blurX:Number=4;
    var blurY:Number=4;
    var distance:Number=3;
    var strength:Number=1.0;
    var inner:Boolean=false;
    var knockout:Boolean=false;
    var quality:Number=BitmapFilterQuality.HIGH;
    return new DropShadowFilter(distance, angle, color, alpha, blurX, blurY, strength, quality, inner, knockout);
   }


   //记录上次选择的Image对象   
   private var oldImg:Image=null;

   //当前选择的节点,显示阴影的方法
   private function clieckHandler(event:MouseEvent):void
   {
    var img:Image=(event.currentTarget) as Image;

    if (oldImg != null)
    {
     oldImg.filters=[];
    }

    if (img.filters.length == 0)
    {
     img.filters=[getDropShadowFilter()];
    }
    else
    {
     img.filters=[];
    }

    oldImg=img;
   }
   
  ]]>
 </mx:Script>

 

   <!-- 节点工具栏 -->
   <mx:Canvas width="2%" height="100%" borderStyle="solid" borderColor="black" shadowDistance="0" cornerRadius="8" borderThickness="1" dropShadowEnabled="true">
    <mx:VBox height="100%" width="100%" horizontalAlign="center">
     <mx:Text text=""/>
     <mx:Image source="../images/application_get.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:Image source="../images/add.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:HRule width="100%"/>
     <mx:Image source="../images/application.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:Image source="../images/arrow_in.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:Image source="../images/arrow_right.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:HRule width="100%"/>
     <mx:Image source="../images/arrow_rotate_anticlockwise.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:Image source="../images/asterisk_yellow.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:Image source="../images/award_star_gold_3.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:Image source="../images/bell_delete.png" completeEffect="Fade" click="clieckHandler(event);"/>
     <mx:HRule width="100%"/>
    </mx:VBox>
   </mx:Canvas>
   

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值