第一种:
<?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>