A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [F8] For Loop with Mind of its Own!!!!

  1. #1
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80

    [F8] For Loop with Mind of its Own!!!!

    Code:
    for (i=0; i<firstDay; i++) {
       dateHolder[i].text = "";
    }
    for (i=firstDay; i<=_root.daysInMonth[month]; i++) {
       trace(dateTracker + ":" + _root.daysInMonth[month]);
       dateHolder[i].text = dateTracker;
       dateTracker++;
    }
    for (i=i; i<=42; i++) {
       trace(i);
       dateHolder[i].text = "";
    }
    I have this series of loops I use to fillin dates of a calendar. The first one sets teh days before teh firstDay blank. The second nunmbers 1 to number of days in the month and the last is for blank days at the end of the calendar.

    I trace both dateTrack and daysInMonth[month] and for august its 31. But my loop stops at 29? wtf?

    Ive attached the whole file as well.
    Attached Files Attached Files

  2. #2
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    ok I figured it out. firstDay doesnt mean 1 cause it is a numerical representation of the day of teh week. In this case its 3 for Wednesday and 3 to 31 is 29.

  3. #3
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Glad you solved it, but when this happens, share the code please.

    code:

    for (i=firstDay; i<=firstDay + daysInMonth[month]; i++) {
    trace(dateTracker + ":" + _root.daysInMonth[month]);
    dateHolder[i].text = dateTracker;
    dateTracker++;
    }

    for (i= firstDay + daysInMonth[month]; i<=42; i++) {
    trace(i);
    dateHolder[i].text = "";
    }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center