Hi Greg and Alex,
The reason is related with string format in DateFormatter, setter is not
implemented and format function is not implemented either.
The setter for formatString is commented. I can create PR for the change
but it is not simple. It requires to initialization of resource manager
"SharedResoources" and I guess it inherits from the class Formatter
which is also commented.
The function :
public function set formatString(value:String):void
{
/* formatStringOverride = value;
_formatString = value != null ?
value :
resourceManager.getString(
"SharedResources", "dateFormat"); */
}
Simply can solve if change to :
public function set formatString(value:String):void
{
_formatString = value;
/* formatStringOverride = value;
_formatString = value != null ?
value :
resourceManager.getString(
"SharedResources", "dateFormat"); */
}
But the format function needs more work.
Thanks,
Serkan
21.10.2019 01:59 tarihinde Greg Dove yazdı:
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]
<mailto:[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]
<mailto:[email protected]>>
*Reply-To: *"[email protected]
<mailto:[email protected]>" <[email protected]
<mailto:[email protected]>>
*Date: *Sunday, October 20, 2019 at 8:19 AM
*To: *"[email protected] <mailto:[email protected]>"
<[email protected] <mailto:[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}"/>