You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Serkan Taş <se...@likyateknoloji.com> on 2019/10/20 15:18:58 UTC

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}"/>

Re: Printing current date/time header

Posted by Serkan Taş <se...@likyateknoloji.com>.
Hi Alex,

I fixed the issue using the below code piece :

COMPILE::JS
                     {
                         var dateTime = new Date();
                         time = dateTime.toLocaleTimeString() + ' ' + 
dateTime.toLocaleDateString();

                     }

Thanks
Serkan

21.10.2019 12:17 tarihinde Serkan Taş yazdı:
> Hi Alex, is toLocaleDateString() js function ?
>
> Are there any examples or usage of the function ?
>
> Thanks,
> Serkan
>
> 21.10.2019 11:14 tarihinde Serkan Taş yazdı:
>> js is ok for me, I will check toLocaleDateString() for use.
>>
>> Thanks,
>> Serkan
>>
>> Android için Outlook <https://aka.ms/ghei36>'u edinin
>>
>>
>>
>>
>> On Mon, Oct 21, 2019 at 10:53 AM +0300, "Alex Harui" 
>> <aharui@adobe.com <ma...@adobe.com>> wrote:
>>
>>     If all you need is a JS version, you might be able to just call
>>     toLocaleDateString() for now.
>>
>>     -Alex
>>
>>     *From: *Serkan Taş <se...@likyateknoloji.com>
>>     *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
>>     *Date: *Sunday, October 20, 2019 at 11:35 PM
>>     *To: *"users@royale.apache.org" <us...@royale.apache.org>
>>     *Subject: *Re: Printing current date/time header
>>
>>     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 <aharui@adobe.com
>>         <ma...@adobe.com>> 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ş <serkan.tas@likyateknoloji.com
>>             <ma...@likyateknoloji.com>>
>>             *Reply-To: *"users@royale.apache.org
>>             <ma...@royale.apache.org>"
>>             <users@royale.apache.org <ma...@royale.apache.org>>
>>             *Date: *Sunday, October 20, 2019 at 8:19 AM
>>             *To: *"users@royale.apache.org
>>             <ma...@royale.apache.org>"
>>             <users@royale.apache.org <ma...@royale.apache.org>>
>>             *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}"/>
>>
>>
>>
>


Re: Printing current date/time header

Posted by Serkan Taş <se...@likyateknoloji.com>.
Hi Alex, is toLocaleDateString() js function ?

Are there any examples or usage of the function ?

Thanks,
Serkan

21.10.2019 11:14 tarihinde Serkan Taş yazdı:
> js is ok for me, I will check toLocaleDateString() for use.
>
> Thanks,
> Serkan
>
> Android için Outlook <https://aka.ms/ghei36>'u edinin
>
>
>
>
> On Mon, Oct 21, 2019 at 10:53 AM +0300, "Alex Harui" <aharui@adobe.com 
> <ma...@adobe.com>> wrote:
>
>     If all you need is a JS version, you might be able to just call
>     toLocaleDateString() for now.
>
>     -Alex
>
>     *From: *Serkan Taş <se...@likyateknoloji.com>
>     *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
>     *Date: *Sunday, October 20, 2019 at 11:35 PM
>     *To: *"users@royale.apache.org" <us...@royale.apache.org>
>     *Subject: *Re: Printing current date/time header
>
>     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 <aharui@adobe.com
>         <ma...@adobe.com>> 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ş <serkan.tas@likyateknoloji.com
>             <ma...@likyateknoloji.com>>
>             *Reply-To: *"users@royale.apache.org
>             <ma...@royale.apache.org>" <users@royale.apache.org
>             <ma...@royale.apache.org>>
>             *Date: *Sunday, October 20, 2019 at 8:19 AM
>             *To: *"users@royale.apache.org
>             <ma...@royale.apache.org>" <users@royale.apache.org
>             <ma...@royale.apache.org>>
>             *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}"/>
>
>
>


Re: Printing current date/time header

Posted by Serkan Taş <se...@likyateknoloji.com>.
js is ok for me, I will check toLocaleDateString() for use.




Thanks,


Serkan




Android için Outlook'u edinin







On Mon, Oct 21, 2019 at 10:53 AM +0300, "Alex Harui" <ah...@adobe.com> wrote:




















If all you need is a JS version, you might be able to just call toLocaleDateString() for now.


 


-Alex


 



From:
Serkan Taş <se...@likyateknoloji.com>

Reply-To: "users@royale.apache.org" <us...@royale.apache.org>

Date: Sunday, October 20, 2019 at 11:35 PM

To: "users@royale.apache.org" <us...@royale.apache.org>

Subject: Re: Printing current date/time header




 




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 <ah...@adobe.com> 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ş <se...@likyateknoloji.com>

Reply-To: "users@royale.apache.org" <us...@royale.apache.org>

Date: Sunday, October 20, 2019 at 8:19 AM

To: "users@royale.apache.org" <us...@royale.apache.org>

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}"/>





















Re: Printing current date/time header

Posted by Alex Harui <ah...@adobe.com>.
If all you need is a JS version, you might be able to just call toLocaleDateString() for now.

-Alex

From: Serkan Taş <se...@likyateknoloji.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Sunday, October 20, 2019 at 11:35 PM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Printing current date/time header

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 <ah...@adobe.com>> 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ş <se...@likyateknoloji.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
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}"/>



Re: Printing current date/time header

Posted by Serkan Taş <se...@likyateknoloji.com>.
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 <aharui@adobe.com 
> <ma...@adobe.com>> 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ş <serkan.tas@likyateknoloji.com
>     <ma...@likyateknoloji.com>>
>     *Reply-To: *"users@royale.apache.org
>     <ma...@royale.apache.org>" <users@royale.apache.org
>     <ma...@royale.apache.org>>
>     *Date: *Sunday, October 20, 2019 at 8:19 AM
>     *To: *"users@royale.apache.org <ma...@royale.apache.org>"
>     <users@royale.apache.org <ma...@royale.apache.org>>
>     *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}"/>
>


Re: Printing current date/time header

Posted by Greg Dove <gr...@gmail.com>.
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 <ah...@adobe.com> 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ş <se...@likyateknoloji.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Sunday, October 20, 2019 at 8:19 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *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}"/>
>
>

Re: Printing current date/time header

Posted by Alex Harui <ah...@adobe.com>.
I’d be interested to know why the Flex version did not work in Royale.  Did you debug into it?

-Alex

From: Serkan Taş <se...@likyateknoloji.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Sunday, October 20, 2019 at 8:19 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
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}"/>