Adding hours to Flex timer

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Adding hours to Flex timer

    I am attempting to add hours to my Flex timer and it is not working? The hour
    column starts at 18....Any ideas

    private const HOUR_MASK:String = "00";
    private const MIN_MASK:String = "00";
    private const SEC_MASK:String = "00";
    private const MS_MASK:String = "000";
    private const TIMER_INTERVAL:int = 10;

    private var baseTimer:int;
    private var t:Timer;

    private function init():void{
    t = new Timer(TIMER_INTERVAL);
    t.addEventListener(TimerEvent.TIMER, updateTimer);
    baseTimer = getTimer();
    t.start();
    }


    private function updateTimer(evt:TimerEvent):void {
    var d:Date = new Date(getTimer() - baseTimer);
    var hour:String = (HOUR_MASK + d.hours).substr(-HOUR_MASK.length);
    var min:String = (MIN_MASK + d.minutes).substr(-MIN_MASK.length);
    var sec:String = (SEC_MASK + d.seconds).substr(-SEC_MASK.length);
    var ms:String = (MS_MASK + d.milliseconds).substr(-MS_MASK.length);
    callTime.text = String(hour + ":" + min + ":" + sec);
    }

    <mx:TextInput id="callTime" fontSize="10" editable="true" width="82"
    height="19"/>

    nrutter Guest

  2. Similar Questions and Discussions

    1. Dynamically Adding Vertical Axis to Flex Charts
      Hello, I have an application that enables the users to dynamically select what series their chart is displaying. Users often want to plot multiple...
    2. Flex 2.0 Dynamically adding columns to a DataGrid (worked in 1.5)
      I have code that works fine in v1.5 to add columns to a mx.controls.DataGrid but there is no method addColumn() in 2.0 Any help on this would be...
    3. Could I use flash.util.* Timer and interval in Flex 1.5
      Could I use import flash.util.* Timer and interval in Flex 1.5. ???? Is there any sample code for timely refresh the table data? Thanks for...
    4. adding hours to a dateTime object
      I have a datetime object (now()) and timedifference via getTimeZone() - eg "5" hours. Now I want to hava new dateTime object that differs from now()...
    5. System.Timers.Timer vs. System.Threading.Timer
      Hi Just a quick question... When would you use System.Timers.Timer, and when System.Threading.Timer? What are the principal differences...
  3. #2

    Default Re: Adding hours to Flex timer

    any ideas on this??
    nrutter Guest

  4. #3

    Default Re: Adding hours to Flex timer

    I do not see anything wrong. You will just need to debug this.

    I don't really understand the problem either. Is there no data for hours or
    the wrong data?

    does d.hours return a value?

    trace(hour); //what doe it display?

    Tracy

    ntsiii Guest

  5. #4

    Default Re: Adding hours to Flex timer

    var ms:Number = getTimer() - baseTimer
    var d:Date = new Date(0, 0, 0, 0, 0, 0, ms);
    var hrs:String = (HRS_MASK + d.hours).substr(-HRS_MASK.length);
    vaig Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139