2 Replies Latest reply on Feb 8, 2007 12:53 PM by Nickels55

    Digital Clock in Flash 8

    rbmbhs
      I have been trying to put a digital clock into my Flash 8 websites for I don't know how long. I have read dozens of tutorials, watched videos, and read books but no matter what Action Script I write, it doesn't work. The latest script returned "_level0.inst" when I tested the movie. The variable is named correctly and I followed the steps from a video tutorial where it worked perfectly for them. Do I have some setting that is messing it up? Here is the code:
        • 1. Re: Digital Clock in Flash 8
          Level 7
          Put this actionscript on frame 1 of a new Flash Document, and create a
          dynamic text field with the instance name of myClock.


          var intervalId:Number;
          var count:Number = 0;
          var maxCount:Number = 2000;//number of times it will change
          var duration:Number = 100;// how often in miliseconds it will change
          function executeCallback():Void {
          myTime = new Date();
          Seconds = myTime.getSeconds();
          Minutes = myTime.getMinutes();
          Hours = myTime.getHours();
          if (Hours>=12) {
          ampm = "pm";
          } else {
          ampm = "am";
          }
          if (Hours>=13) {
          Hours = Hours-12;
          }
          if (length(Minutes) == 1) {
          Minutes = "0"+Minutes;
          }
          if (length(Seconds) == 1) {
          nSeconds = "0"+nSeconds;
          }
          Clock = Hours+":"+Minutes+":"+Seconds+" "+ampm;
          myClock.text = Clock;
          if (count>=maxCount) {
          clearInterval(intervalId);
          }
          count++;
          }
          intervalId = setInterval(this, "executeCallback", duration);


          --

          Dan Mode
          --> Adobe Community Expert
          *Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
          *THE online Radio* http://www.tornadostream.com
          *Must Read* http://www.smithmediafusion.com/blog



          "rbmbhs" <webforumsuser@macromedia.com> wrote in message
          news:eqfqf0$46$1@forums.macromedia.com...
          >I have been trying to put a digital clock into my Flash 8 websites for I
          >don't
          > know how long. I have read dozens of tutorials, watched videos, and read
          > books
          > but no matter what Action Script I write, it doesn't work. The latest
          > script
          > returned "_level0.inst" when I tested the movie. The variable is named
          > correctly and I followed the steps from a video tutorial where it worked
          > perfectly for them. Do I have some setting that is messing it up? Here is
          > the
          > code:
          >
          > onClipEvent (enterFrame) {
          > myTime = new Date ();
          > Seconds = myTime.getSeconds();
          > Minutes = myTime.getMinutes ();
          > Hours = myTime.getHours();
          > if (Hours>=12) {
          > ampm = "pm";
          > } else {
          > ampm = "am";
          > }
          > if (Hours>=13) {
          > Hours = Hours-12;
          > }
          > if (length(Minutes) == 1) {
          > Minutes = "0"+Minutes;
          > }
          > if(length(Seconds) == 1) {
          > nSeconds = "0"+nSeconds;
          > }
          > Clock = Hours+":"+Minutes+":"+Seconds+ " "+ampm;
          > }
          >


          • 2. Re: Digital Clock in Flash 8
            Nickels55 Level 2
            I posted a reply and a file sample on the main board where you cross-posted this question.