3 Replies Latest reply on Oct 17, 2006 8:37 AM by Newsgroup_User

    Analogic clock

    pr777
      Hi, i've this analogic clock movieclip with the following code:

      time = new Date();
      hours = time.getHours();
      minutes = time.getMinutes();
      seconds = time.getSeconds();
      if (hours>12) {
      hours = hours-12;
      }
      if (hours<1) {
      hours = 12;
      }
      hours = hours*30+int(minutes/2);
      minutes = minutes*6+int(seconds/10);
      seconds = seconds*6;

      that works find when i run it by it self,

      but when put it inside the main movieclip of the site it doesn´t work, i´ve tried with _root.time or _root.gethours or _root.hours(minutes and seconds), also have given it a instance name "watch" and a linkage name.

      all this tries end up useless, what's necessary to make the watch work inside a movieclip.

      I please appreciate your help, thanks.

      Pedro Ribeiro
        • 1. Re: Analogic clock
          kglad Adobe Community Professional & MVP
          there's no problem with your code. the issue is the code that relates the movieclip clock hands to those variables.
          • 2. Re: Analogic clock
            Level 7
            "watch" is a method name (see Object.watch). Try changing the instance name.


            • 3. Re: Analogic clock
              Level 7
              What exactly does or does not work. Posted here is a series of
              calculations. You basically can't go wrong there...

              Where's the visualisation? Why the multiplication? (or am I missing
              something?)

              Manno

              pr777 wrote:
              > Hi, i've this analogic clock movieclip with the following code:
              >
              > time = new Date();
              > hours = time.getHours();
              > minutes = time.getMinutes();
              > seconds = time.getSeconds();
              > if (hours>12) {
              > hours = hours-12;
              > }
              > if (hours<1) {
              > hours = 12;
              > }
              > hours = hours*30+int(minutes/2);
              > minutes = minutes*6+int(seconds/10);
              > seconds = seconds*6;
              >
              > that works find when i run it by it self,
              >
              > but when put it inside the main movieclip of the site it doesn´t work, i´ve
              > tried with _root.time or _root.gethours or _root.hours(minutes and seconds),
              > also have given it a instance name "watch" and a linkage name.
              >
              > all this tries end up useless, what's necessary to make the watch work inside
              > a movieclip.
              >
              > I please appreciate your help, thanks.
              >
              > Pedro Ribeiro
              >

              --
              ----------
              Manno Bult
              manno@xs4all.nl