I just did something like that..

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" initialize="this.init();">
<mx:Script>
        <![CDATA[
                import flash.utils.setInterval;
                import flash.utils.clearInterval;
                
                private function init():void {
                        flash.utils.setInterval(this.resetNow, 1000);
                }
                
                
                private function resetNow():void {
                        this.now = new Date();
                }
                
                private function set now(d:Date):void {
                        this.nowText = d.toTimeString();
                }
                
                [Bindable]
                private var nowText:String = "";
                
                
        ]]>
</mx:Script>
        <mx:Panel x="55" y="43" width="487" height="371" layout="absolute"
title="Time" creationComplete="this.resetNow();">
                <mx:Form width="100%" height="100%">
                        <mx:FormHeading label="Time"/>
                        <mx:HRule width="100%"/>
                        <mx:FormItem label="Now">
                                <mx:Text text="{this.nowText}"/>
                        </mx:FormItem>
                </mx:Form>
        </mx:Panel>
</mx:Application>


You'll have to play around with DateFormatters to get the kind of
display you want.  But as you can see it's very simple.  Note however
that this could slow down the responsiveness of your app.

Paul

--- In flexcoders@yahoogroups.com, "Chad Gray" <[EMAIL PROTECTED]> wrote:
>
> I need the current time in my flex app.
> 
> Also is it possible to display the current time in the flex app
having it always current?  So the user would watch the seconds and
minutes change?
> 
> How is best handled?  Is this an actionscript thing?
> 
> Thanks,
> Chad
>


Reply via email to