5 Replies Latest reply on Sep 11, 2009 8:42 PM by kglad

    Using charAt for more than 1 line?

    SalvationD

      Alright, so can someone tell me how to use charAt for 1 file on more than 1 line?

       

      I'm using this

       

      relText.load("Count.txt");
      // Declaring Releasing Date ( 01.07.07 - 00:00:00 )
      var relYear = Number(relDt.charAt(6)+relDt.charAt(7)+relDt.charAt(8)+relDt.charAt(9));
      var relMonth = Number(relDt.charAt(3)+relDt.charAt(4))-1;
      var relDay = Number(relDt.charAt(0)+relDt.charAt(1))-1;
      var relDate:Date = new Date(relYear, relMonth, relDay, 23, 59, 59, 99);
      

      and Count.txt has

      09-21-2009

       

      But I'm wanting to have the actionscript have more than 1 timer in the flash running at the SAME time, due to the fact that I will be having multiple timers for different things.. so ideally if i can make the charAt look in the same file just different lines that would help out SO much!

        • 1. Re: Using charAt for more than 1 line?
          kglad Adobe Community Professional & MVP

          what exactly are you trying to do?

          • 2. Re: Using charAt for more than 1 line?
            SalvationD Level 1

            I'm trying to make a countdown timer (with a picture backdrop) that has something like

             

            Time till 1st Release

            (Countdown #1)

             

            Time till 2nd Release

            (Countdown #2)

             

            Time till Guru Status

            (Countdown #3)

             

            Time till the end of month

            (Countdown #4)

             

            Time till birthday

            (Countdown #5)

             

             

            Something similar to that.

             

            Edit: That has Months, Weeks, Days, Hours, Seconds.

            • 3. Re: Using charAt for more than 1 line?
              kglad Adobe Community Professional & MVP

              and you want to create several date instances using data from a text file?

              • 4. Re: Using charAt for more than 1 line?
                SalvationD Level 1

                Yes.  I'm wanting to have set dates in a file (or flash if that's easier.. but currently I have it set in the file Count.txt)

                and I want it to read the local computer / server's time and give me a countdown (Month, Weeks, Days, Hours, Seconds)

                 

                I have a sample file now.. but they all just use 1 date or 1 line with a date.. I want to have MULTIPLE dates (timers) in 1 flash file.

                 

                like

                 

                Countdown till 9-29-2009

                Countdown till 10-03-2009

                Countdown till 11-03-2009

                Countdown till 11-05-2009

                Countdown till 04-11-2010

                 

                 

                Right now I can have just 1 date.. The 09-29-2009, but I'm wanting to have 4 more dates that it reads and has multiple countdowns.

                • 5. Re: Using charAt for more than 1 line?
                  kglad Adobe Community Professional & MVP

                  you don't need multiple timers.  you just need one countdown timer that reports that countdown to the various dates:

                   

                  var date1:Date=new Date(whatever);

                  var date2:Date=new Date(whatever else);

                  var date3:Date=new Date(etc);

                   

                  var currentDate:Date=new Date();

                  var c:Number = 1000*60*60*24;

                   

                  this.onEnterFrame=countdownF;

                   

                  function countdownF(){

                  daystodate1 = (date1.getTime()-currentDate.getTime())/c;

                  daystodate2 = (date2.getTime()-currentDate.getTime())/c;

                  daystodate3 = (date3.getTime()-currentDate.getTime())/c;

                  }

                  1 person found this helpful