Hi,
Is there an example of showing current date time on page, as my version
converted from flex is not working.
Thanks
Serkan,
*****************************************
My code for royale (not complete source) :
public function showTime():void {
var currentTime:Date = new Date();
var timeFormat:DateFormatter = new DateFormatter();
timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
time = timeFormat.format(currentTime);
ticker = new Timer(1,1);
ticker.addEventListener(Timer.TIMER, onTimerComplete);
ticker.start();
}
public function onCreationComplete():void {
showTime();
}
public function onTimerComplete(event:Timer):void {
showTime();
}
to show :
<s:Button id="button1" width="200" label="Time : {time}"
click="button_clickHandler(event)"/>
*****************************************
Flex version which is working (not complete source):
public function showTime():void {
var currentTime:Date = new Date();
var timeFormat:DateFormatter = new DateFormatter();
timeFormat.formatString = "DD/MM/YYYY JJ:NN:SS"
time = timeFormat.format(currentTime);
ticker = new Timer(1,1);
ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
ticker.start();
}
public function onCreationComplete():void {
showTime();
}
public function onTimerComplete(event:TimerEvent):void {
showTime();
}
to show :
<s:Label y="-18" right="90" fontWeight="bold" text="{time}"/>