A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: clock problem

  1. #1
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79

    clock problem

    i have placed the following code in frame 1 which then displays the current time in relevant dynamic text box.
    Any ideas what i have missed because the time doesn't update itself-it just stays at the time you entered the page at

    now=new Date()
    //txt1.text=now.getHours()+":"+now.getMinutes()+":"+ now.getSeconds()
    h=now.getHours()
    if (h<10){
    h="0"+h
    }
    m=now.getMinutes()
    if (m<10){
    m="0"+m;
    }
    s=now.getSeconds()
    if (s<10){
    s="0"+s
    }
    ms=now.getMilliseconds()
    if (ms<10){
    ms="0"+ms
    }

    txt1.text=h+":"+m

  2. #2
    Senior Member pherbrick's Avatar
    Join Date
    Jul 2004
    Location
    Los Angeles
    Posts
    291
    Hmm. The compiler let you get away with not using semicolons?

    Anyway, you need a loop using onEnterFrame() or some other means of repeatedly executing the code. A low frame rate is okay (I used 12) since you're only looking a minutes or seconds, and reduces cpu processing load. I was going to post a solution zip file, but I can't open the manage attachments window - oops, now its working. Enjoy .

    Peter

    P.S. Alternatively, you can add a second key frame and create a "gotoAndPlay(1);" loop.
    Attached Files Attached Files
    Last edited by pherbrick; 08-25-2005 at 01:03 PM. Reason: Fixing solution description, in italics

  3. #3
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    i cant open your attachment - says it was created using a later version of km.
    cant put version5 on for the moment cause i have a few probs with my pc

    thanks

  4. #4
    Senior Member pherbrick's Avatar
    Join Date
    Jul 2004
    Location
    Los Angeles
    Posts
    291
    4.7.2 version attached; I kept my old executable .

    Anybody posting for help, please mention if you're not using the latest release version of KoolMoves. The trial version is not always the latest release version, so if you're using the trial version please make a note of the version number under the Help Menu > About KoolMoves.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center