flex 4里闪烁效果

第一种:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2010/08/13/creating-blinking-text-on-a-spark-richtext-control-in-flex-4/ -->
<s:Application name="Spark_RichText_blink_test"
      xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx">
 <s:layout>
  <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle" />
 </s:layout>
 
 <fx:Declarations>
  <s:Animate id="fader"
       duration="500"
       repeatBehavior="reverse"
       repeatCount="0"
       target="{lbl}">
   <s:SimpleMotionPath property="alpha"
        valueFrom="1.0" valueTo="0.0" />
  </s:Animate>
 </fx:Declarations>
 
 <s:Label id="lbl"
    text="BLINKING TEXT, I HATE YOU!"
    color="red"
    fontSize="32"
    creationComplete="fader.play();" />
 
</s:Application>

 

 

第二种:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute" minWidth="955" minHeight="600"
    creationComplete="application1_creationCompleteHandler(event)">
 
 <mx:Script>
  <![CDATA[
   import flash.filters.GlowFilter;
   
   import mx.core.UIComponent;
   import mx.events.FlexEvent;
   private function initApp():void{
    var sh:UIComponent=new UIComponent();
    sh.graphics.beginFill(0x00FF00) ;
    sh.graphics.drawRect(100,100,200,200) ;
    sh.graphics.drawCircle(0,0,100);
    sh.graphics.endFill() ;
    can.addChild(sh) ;
   }
   protected function button1_clickHandler(event:MouseEvent):void
   {
    var g:GlowFilter=new GlowFilter(0x00FF00);
    
    
    //  shan.filters = [g];
    glow1.target = shan; 
    glow1.target = can; 
    glow1.play();
    
   }
   
   protected function application1_creationCompleteHandler(event:FlexEvent):void
   {
    
    initApp();
   }
   
  ]]>
 </mx:Script>
 <mx:Canvas id="can" x="100" y="100" backgroundColor="#ffffff" width="80" height="50">
  
 </mx:Canvas>
 <mx:Glow id="glow1" blurXFrom="0" color="0xFF0000" blurXTo="50"
    blurYFrom="0" blurYTo="70"  repeatDelay="100"  repeatCount="100000000"
    alphaTo="1" alphaFrom="0.3"/>
 <mx:Button x="20" y="26" width="26" height="20" click="button1_clickHandler(event)" id="shan"/>
</mx:Application>

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值