8 Replies Latest reply on Apr 12, 2013 12:04 AM by Ron Colmen

    Logic behind the error??

    Ron Colmen Level 2

      It's a countdown clock.

      At the start it loads a time to begin the countdown. The countdwon continues until condition1 is false. While condition1 is false, if button15 is clicked the countdown should continue from where it left.

      My question is when button15 is clicked, the countdown does not continue from where it left? It continues as _root.onEnterFrame = CountDown; has kept on going while conditionA was false?? How do I make the countdown clock continue from where condition1 was false?

      ?

       

      var start_dateFixed:Date = new Date();

      var start_milFixed:Number = start_dateFixed.getTime();

      var start_secondsFixed:Number = start_milFixed/1000;

       

      SndLoad.sendAndLoad("http://www.web.com/the.php",RscLoad,"POST");

      RecLoad.onData = function(src) {

           var a:Array=src.split(",,");

           var Bcountdown = Math.floor(60 - a[0]);

           timeRem.text = Math.floor((Bcountdown) + (start_secondsFixed));

           _root.onEnterFrame = CountDown;

      }

       

       

      function CountDown(){

      if (conditionA == true) {

         var bringTimeSrt = timeRem.text;

        var start_date:Date = new Date();

        var start_mil:Number = start_date.getTime();

        var start_seconds:Number = start_mil/1000;

        var remTIme = bringTimeSrt - start_seconds;

       

        var sec = Math.floor(remTIme);

        var min = Math.floor(sec/60);

        var hrs = Math.floor(min/60);

        sec = string(sec % 60);

        if(sec.length < 2) {

        sec = "0" + sec;

        }

        min = string(min % 60);

        if(min.length < 2) {

        min = "0" + min;

        }

        hrs = string(hrs % 24);

        if(hrs.length < 2) {

        hrs = "0" + hrs;

        }

        var theRemPeriod:String = hrs + " : " + min + " : " + sec;

        cntDwnClock.text = theRemPeriod;

      }

      }

       

      function newFunction() {

      if (condition1==true) {

      conditionA

      }

      }

      triggerConditionA = setInterval(newFunction, 2000);

       

      button15.onRelease = function () { // does not contine from where it stopped?

        var start_dateFixed:Date = new Date();

        var start_milFixed:Number = start_dateFixed.getTime();

        var start_secondsFixed:Number = start_milFixed/1000;

        timeRem.text="";

        SndLoad.sendAndLoad("http://www.web.com/the.php",RscLoad,"POST");

      }