9 Replies Latest reply on Sep 6, 2009 11:14 AM by andreasfridholm

    change lunch menu each day for a two week period, then start over from the beginning

    andreasfridholm

      So, I need to create a cycle of a 14 day menu, (week1_1-7.txt and week2_1-7.txt).

       

      CODE:

      ------------------------------------------------------------------------------------------ ----------------------------------------------

      function isEvenWeek(now, startDate) {

        var weeks = 604800000; // one week in milliseconds. 
       
      return Math.floor((now - startDate) / weeks) % 2 == 0;
      }

      // a monday
      var startDate = new Date(2009, 8, 31);
      var now = new Date();

      var src = "";
      if (isEvenWeek(startDate, now)) {
        src
      = "week1";
      } else {
        src
      = "week2";
      }

      ------------------------------------------------------------------------------------------ ----------------------------------------------

       

      This code above I got from a guy who works with javascript and, Im sure it works, but I want to work completely in Flash.

       

      Does anyone knows how to do? I've managed to get an external .txt-file to work properly, but not in this variable day/week-way?

       

      It's a lunch menu which changes everyday for two weeks, then start over from week1_1.txt.

       

      Thank you, thank you, thank you for your help!

       

      / Andy