<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
width="800" height="604" creationComplete="init()" >
<mx:Style>
TabNavigator {
tabStyleName: "myTabs";
firstTabStyleName: "myTabs";
lastTabStyleName: "myTabs";
selectedTabTextStyleName: "mySelectedTabs";
}
.myTabs {
fillColors: #0033cc, #cccccc;
backgroundColor: #00cccc;
text-align:left;
}
.myTabsCligno {
fillColors: #0033cc, #cccccc;
backgroundColor: #FE6801;
text-align:left;
}
.mySelectedTabs {
fillColors: #0033cc, #cccccc;
backgroundColor: #00cccc;
text-align:left;
}
</mx:Style>
<mx:TabNavigator x="0" y="0" width="800" height="269" tabHeight="35" id="tabnavigator1" selectedIndex="0">
<mx:Canvas label="onglet1" width="100%" height="100%" id="onglet_tchat" click="stopClignoTab()">
</mx:Canvas>
<mx:Canvas label="onglet2" width="100%" height="100%" id="onglet_2">
</mx:Canvas>
<mx:Canvas label="onglet3" width="100%" height="100%" id="onglet_3" >
</mx:Canvas>
</mx:TabNavigator>
<mx:Button x="116" y="330" label="Start" width="103" click="startClignoTab()" id="button1"/>
<mx:Button x="285" y="330" label="Stop" click="stopClignoTab()" />
<mx:Script>
<![CDATA[
import mx.containers.TabNavigator;
import flash.utils.Timer;
import flash.events.TimerEvent;
private const TIMER_INTERVAL:int = 500;
private var toggle:Boolean = false;
private var tCligno: Timer;
private const COL_CLIGNO:int = 0xFE6801;
private function clignoteTab(evt:TimerEvent):void {
toggle = !toggle;
var tab : Object;
tab = tabnavigator1.getTabAt(0);
if (toggle==true){
tab.label = 'onglet1: New';
tabnavigator1.setStyle('firstTabStyleName','myTabsCligno');
}else{
tab.label = 'onglet1';
tabnavigator1.setStyle('firstTabStyleName','myTabs');
}
}
public function startClignoTab():void {
tCligno.start();
}
public function stopClignoTab():void {
tCligno.stop();
}
public function init():void{
tCligno = new Timer(TIMER_INTERVAL);
tCligno.addEventListener(TimerEvent.TIMER, clignoteTab);
}
]]>
</mx:Script>
</mx:Application>
Partager