7 Replies Latest reply on Oct 23, 2006 1:03 PM by Pitchsole

    Count Down Time Zone?

    Pitchsole
      Hey all, i have come to this fourm a few times and every time i posted help i got it and i got the right help to. So here i am back again. Now here my problem. i made this count down for a certain event. (yes i got help from someone) and it works fine i made all the images it works great,,,so i though then i thought id experament. So i changed my computers time zone and guess what. The Time changed on the count down. Can i make my count down'er', count down from a specific time zone so it will count down and be the same for everyone? so no matter what time zone you have it will ONLY be for a certain type of time zone? Heres my Count down so far;

      http://snro.ifastnet.com/wipe.html

      And heres the script i have for my count down. Can someone give me a better code, so it will keep my counter the exact same just make it count down from only 1 specific Time zone? (AS below)

      quote:

      stop();

      currentDate = new Date();
      thisYear = currentDate.getFullYear();

      // Date( year, month-1, date [, hour [, minute [, second [, millisecond]]]])
      eventDate = new Date(thisYear, 9, 28, 12);
      eventMillisecs = eventDate.getTime();

      counter.onEnterFrame = function(){
      currentDate = new Date();
      currentMillisecs = currentDate.getTime();
      this.msecs = eventMillisecs - currentMillisecs;
      if (this.msecs <= 0){
      play();
      return;
      }
      this.secs = Math.floor(this.msecs/1000);
      this.mins = Math.floor(this.secs/60);
      this.hours = Math.floor(this.mins/60);
      this.days = Math.floor(this.hours/24);
      this.msecs = string(this.msecs % 1000);
      this.secs = string(this.secs % 60);
      this.mins = string(this.mins % 60);
      this.hours = string(this.hours % 24);
      this.days = string(this.days);

      while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
      if (this.secs.length < 2) this.secs = "0" + this.secs;
      if (this.mins.length < 2) this.mins = "0" + this.mins;
      if (this.hours.length < 2) this.hours = "0" + this.hours;
      while (this.days.length < 3) this.days = "0" + this.days;

      for(movie in this){
      if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
      }
      };

      MovieClip.prototype.evaluateFrameFrom = function(variableClip){
      var nameArray = this._name.split("_");
      var numberSet = variableClip[nameArray[0]];
      var character = number(nameArray[1]);
      var frame = 1 + number(numberSet.charAt(character));
      if (this._currentframe != frame) this.gotoAndStop(frame);
      };


      Thanks!

      Edit** If you can the time zone i need it clocked to is (GMT-06:00) Central Time (US & Canada)
        • 1. Re: Count Down Time Zone?
          Level 7

          "Pitchsole" <webforumsuser@macromedia.com> wrote in message
          news:ehgito$dkt$1@forums.macromedia.com...
          > Hey all, i have come to this fourm a few times and every time i posted
          > help i
          > got it and i got the right help to. So here i am back again. Now here my
          > problem. i made this count down for a certain event. (yes i got help from
          > someone) and it works fine i made all the images it works great,,,so i
          > though
          > then i thought id experament. So i changed my computers time zone and
          > guess
          > what. The Time changed on the count down. Can i make my count down'er',
          > count
          > down from a specific time zone so it will count down and be the same for
          > everyone? so no matter what time zone you have it will ONLY be for a
          > certain
          > type of time zone? Heres my Count down so far;
          >
          > http://snro.ifastnet.com/wipe.html
          >
          > And heres the script i have for my count down. Can someone give me a
          > better
          > code, so it will keep my counter the exact same just make it count down
          > from
          > only 1 specific Time zone? (AS below)
          >
          >
          quote:

          stop();
          >
          > currentDate = new Date();
          > thisYear = currentDate.getFullYear();
          >
          > // Date( year, month-1, date [, hour [, minute [, second [,
          > millisecond]]]])
          > eventDate = new Date(thisYear, 9, 28, 12);
          > eventMillisecs = eventDate.getTime();
          >
          > counter.onEnterFrame = function(){
          > currentDate = new Date();
          > currentMillisecs = currentDate.getTime();
          > this.msecs = eventMillisecs - currentMillisecs;
          > if (this.msecs <= 0){
          > play();
          > return;
          > }
          > this.secs = Math.floor(this.msecs/1000);
          > this.mins = Math.floor(this.secs/60);
          > this.hours = Math.floor(this.mins/60);
          > this.days = Math.floor(this.hours/24);
          > this.msecs = string(this.msecs % 1000);
          > this.secs = string(this.secs % 60);
          > this.mins = string(this.mins % 60);
          > this.hours = string(this.hours % 24);
          > this.days = string(this.days);
          >
          > while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
          > if (this.secs.length < 2) this.secs = "0" + this.secs;
          > if (this.mins.length < 2) this.mins = "0" + this.mins;
          > if (this.hours.length < 2) this.hours = "0" + this.hours;
          > while (this.days.length < 3) this.days = "0" + this.days;
          >
          > for(movie in this){
          > if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
          > }
          > };
          >
          > MovieClip.prototype.evaluateFrameFrom = function(variableClip){
          > var nameArray = this._name.split("_");
          > var numberSet = variableClip[nameArray[0]];
          > var character = number(nameArray[1]);
          > var frame = 1 + number(numberSet.charAt(character));
          > if (this._currentframe != frame) this.gotoAndStop(frame);
          > };

          >
          > Thanks!
          >


          To let you be the one to further experiment I will point you in the right
          direction.

          http://www.adobe.com/livedocs/flashlite/2/main/wwhelp/wwhimpl/common/html/wwhelp.htm?conte xt=LiveDocs_Parts&file=00000468.html

          Use GMT as your main reference for everyone, then offeset that time to your
          timezone.


          • 2. Re: Count Down Time Zone?
            Pitchsole Level 1
            I am confused, i am not good when it comes to AS, as i said some one helped me. Could you tell me wat to do? or wat to put in? or give me a updated script?

            Thank you
            • 3. Re: Count Down Time Zone?
              Level 7

              "Pitchsole" <webforumsuser@macromedia.com> wrote in message
              news:ehgle0$g9i$1@forums.macromedia.com...
              >I am confused, i am not good when it comes to AS, as i said some one helped
              >me. Could you tell me wat to do? or wat to put in? or give me a updated
              >script?
              >
              > Thank you

              Alrighty then....

              My code uses a text box instead of your movie clips... but you should get
              the idea.


              Just stick all of this code in an empty frame of a new movie.




              var hoursDifference:Number = 10;

              stop();

              currentDate = new Date();
              thisYear = currentDate.getFullYear();

              // Date( year, month-1, date [, hour [, minute [, second [,
              millisecond]]]])
              eventDate = new Date(thisYear, 9, 28, 12);
              eventMillisecs = eventDate.getTime();

              var counter:TextField = this.createTextField("timeRemaining_txt", 1, 50,
              50, 200, 20);
              counter.text = "TEST";
              var now = new Date();
              var diffFromGMT = now.getTimezoneOffset();
              trace("Diff: " + diffFromGMT);
              var myTimezoneOffset:Number = hoursDifference * 60;
              trace(myTimezoneOffset);

              this.onEnterFrame = function(){
              currentDate = new Date();
              currentMillisecs = currentDate.getTime();
              trace("inside diff = " + (diffFromGMT - myTimezoneOffset));
              currentMillisecs -= (diffFromGMT - myTimezoneOffset) * 60000;
              this.msecs = eventMillisecs - currentMillisecs;
              if (this.msecs <= 0){
              play();
              return;
              }
              this.secs = Math.floor(this.msecs/1000);
              this.mins = Math.floor(this.secs/60);
              this.hours = Math.floor(this.mins/60);
              this.days = Math.floor(this.hours/24);
              this.msecs = string(this.msecs % 1000);
              this.secs = string(this.secs % 60);
              this.mins = string(this.mins % 60);
              this.hours = string(this.hours % 24);
              this.days = string(this.days);

              while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
              if (this.secs.length < 2) this.secs = "0" + this.secs;
              if (this.mins.length < 2) this.mins = "0" + this.mins;
              if (this.hours.length < 2) this.hours = "0" + this.hours;
              while (this.days.length < 3) this.days = "0" + this.days;

              counter.text = this.days + "D " + this.hours + "H " +
              this.mins + "M " + this.secs + "S " + this.msecs + "ms";
              // for(movie in this){
              //if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
              //}
              };

              /*
              MovieClip.prototype.evaluateFrameFrom = function(variableClip){
              var nameArray = this._name.split("_");
              var numberSet = variableClip[nameArray[0]];
              var character = number(nameArray[1]);
              var frame = 1 + number(numberSet.charAt(character));
              if (this._currentframe != frame) this.gotoAndStop(frame);
              };
              */


              • 4. Re: Count Down Time Zone?
                Level 7
                I meant to include a comment for the first line

                var hoursDifference:Number = 10;
                // express your number of hours different from GMT.
                // Although you need to use the opposite sign of the difference
                // so, for the example above it would be for Hawaii.



                • 5. Re: Count Down Time Zone?
                  Pitchsole Level 1
                  Well umm..i kinda get it but i do not know wha to replace or wat to take away or wat to add. Couldnt i just add var hoursDifference:Number = 10; and the beggining of my script? or would i have to change the entire thing?
                  • 6. Re: Count Down Time Zone?
                    Level 7
                    Well, I was hoping you could take my example and look at it to figure it
                    out... but here you go:

                    ** Just add the lines with the + signs. Then change to hoursDifference to
                    your negative timezone offset. So, 10 is for Hawaii.

                    + var hoursDifference:Number = 10;
                    + var now = new Date();
                    + var diffFromGMT = now.getTimezoneOffset();
                    + var myTimezoneOffset:Number = hoursDifference * 60;

                    currentDate = new Date();
                    thisYear = currentDate.getFullYear();

                    // Date( year, month-1, date [, hour [, minute [, second [,
                    millisecond]]]])
                    eventDate = new Date(thisYear, 9, 28, 12);
                    eventMillisecs = eventDate.getTime();

                    counter.onEnterFrame = function(){
                    currentDate = new Date();
                    currentMillisecs = currentDate.getTime();
                    + currentMillisecs -= (diffFromGMT - myTimezoneOffset) * 60000;
                    this.msecs = eventMillisecs - currentMillisecs;
                    if (this.msecs <= 0){
                    play();
                    return;
                    }
                    this.secs = Math.floor(this.msecs/1000);
                    this.mins = Math.floor(this.secs/60);
                    this.hours = Math.floor(this.mins/60);
                    this.days = Math.floor(this.hours/24);
                    this.msecs = string(this.msecs % 1000);
                    this.secs = string(this.secs % 60);
                    this.mins = string(this.mins % 60);
                    this.hours = string(this.hours % 24);
                    this.days = string(this.days);

                    while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
                    if (this.secs.length < 2) this.secs = "0" + this.secs;
                    if (this.mins.length < 2) this.mins = "0" + this.mins;
                    if (this.hours.length < 2) this.hours = "0" + this.hours;
                    while (this.days.length < 3) this.days = "0" + this.days;

                    for(movie in this){
                    if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
                    }
                    };

                    MovieClip.prototype.evaluateFrameFrom = function(variableClip){
                    var nameArray = this._name.split("_");
                    var numberSet = variableClip[nameArray[0]];
                    var character = number(nameArray[1]);
                    var frame = 1 + number(numberSet.charAt(character));
                    if (this._currentframe != frame) this.gotoAndStop(frame);
                    };


                    • 7. Re: Count Down Time Zone?
                      Pitchsole Level 1
                      Thank You!