Mega Code Archive

 
Categories / Flex / Effects
 

Playing an effect with ActionScript and Glow control

<?xml version="1.0"?>  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     backgroundColor="white" initialize="initMe()">     <mx:Script>                  import flash.utils.Timer;         [Bindable]         public var secondsTillDue:int=120;         public var myTimer:Timer;         public function initMe():void         {             myTimer = new Timer(1000);             myTimer.addEventListener('timer',warnIfClose);             myTimer.start();         }         public function warnIfClose(event:TimerEvent):void         {             secondsTillDue = secondsTillDue - 1;             if(secondsTillDue < 90)             {                 myEffect.target = idDueLabel;                 myEffect.play();             }         }            </mx:Script>     <mx:Glow id="myEffect" duration="750" alphaFrom="1.0" alphaTo="0.3"         blurXFrom="0.0" blurXTo="50.0" blurYFrom="0.0" blurYTo="50.0"         color="0xFF0000" />     <mx:Label text="This is due in {secondsTillDue} seconds"         id="idDueLabel" /> </mx:Application>