Alex, I'm guessing it is DateFormatter. I think that just returns empty string, or at least it did a few weeks ago when I tried to use it.
On Mon, Oct 21, 2019 at 11:41 AM Alex Harui <[email protected]> wrote: > I’d be interested to know why the Flex version did not work in Royale. > Did you debug into it? > > > > -Alex > > > > *From: *Serkan Taş <[email protected]> > *Reply-To: *"[email protected]" <[email protected]> > *Date: *Sunday, October 20, 2019 at 8:19 AM > *To: *"[email protected]" <[email protected]> > *Subject: *Printing current date/time header > > > > 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}"/> > >
