5 Replies Latest reply on Apr 5, 2009 3:55 PM by kglad

    Help on moving frames with new Date()

    pao1011

      I'm a AS beginer and I need help. I trying to move frames accordind to the hour, for example: at 7 am the at frame 1 and at 8 am at frame 10. I have a code that moves the frames every one hour but I need also to move the by the half hour. For instance: at 7 am frame 1, at 7:30 am frame 5, and at 8 am frame 10. This is the code I have so far that moves ever hour:

       

      // new Date object
      myDate = new Date();
      myHour = myDate.getHours();

      _root.onLoad = function() {
      switch (myHour) {
      //this start at 7 am and end at 6 am
      case 7 :
        trace("It's 7:00 AM");
        switcher_mc.gotoAndStop(1);

        break;
      case 8 :
        trace("It's 8:00 AM");
        switcher_mc.gotoAndStop(3);
        break;
      case 9 :
        trace("It's 9:00 AM");
        switcher_mc.gotoAndStop(5);
        break;
      case 10 :
        trace("It's 10:00 AM");
        switcher_mc.gotoAndStop(7);
        break;

      and so on till 6 am. As you see I need some half hours for some frames.

       

      I will appreciate any help.

      Thanks in advance

      Pao Pao