<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="OnCreationComplete()">
<mx:Script>
<![CDATA[
import flash.utils.Timer;
import flash.events.TimerEvent;
private var tmrSlideShow:Timer = null;
private var bIsWhitePanel:Boolean = false;
public function OnCreationComplete():void
{
changeBackgroundColor(500);
}
public function changeBackgroundColor(nTimeInterval:Number):void
{
tmrSlideShow = new Timer(nTimeInterval,0);
tmrSlideShow.addEventListener("timer", slideShowTimerHandler);
tmrSlideShow.start();
}
public function slideShowTimerHandler(event:TimerEvent):void
{
if(bIsWhitePanel)
{
myPanel.setStyle("backgroundColor","white");
bIsWhitePanel = false;
}
else
{
myPanel.setStyle("backgroundColor","red");
bIsWhitePanel = true;
}
}
]]>
</mx:Script>
<mx:Panel x="10" y="10" width="250" height="200" layout="absolute"
id="myPanel" borderStyle="none">
<mx:Button x="73.5" y="128" label="Click Me..!"/>
</mx:Panel>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
creationComplete="OnCreationComplete()">
<mx:Script>
<![CDATA[
import flash.utils.Timer;
import flash.events.TimerEvent;
private var tmrSlideShow:Timer = null;
private var bIsWhitePanel:Boolean = false;
public function OnCreationComplete():void
{
changeBackgroundColor(500);
}
public function changeBackgroundColor(nTimeInterval:Number):void
{
tmrSlideShow = new Timer(nTimeInterval,0);
tmrSlideShow.addEventListener("timer", slideShowTimerHandler);
tmrSlideShow.start();
}
public function slideShowTimerHandler(event:TimerEvent):void
{
if(bIsWhitePanel)
{
myPanel.setStyle("backgroundColor","white");
bIsWhitePanel = false;
}
else
{
myPanel.setStyle("backgroundColor","red");
bIsWhitePanel = true;
}
}
]]>
</mx:Script>
<mx:Panel x="10" y="10" width="250" height="200" layout="absolute"
id="myPanel" borderStyle="none">
<mx:Button x="73.5" y="128" label="Click Me..!"/>
</mx:Panel>
</mx:Application>