Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 06-14-2007, 12:29 AM   #1
PibbTibbs
Registered User
 
Join Date: Apr 2007
Location: Canada
Posts: 42
Default help laying out first day of the month. Trying to build an event calendar

Hi

I wanted to try and build an event calendar. I have the calendar portion working fine except i cannot wrap my head around the right way to both determine the first day of the month for any given month and subsequently shifting the first day movie clip to the correct position under the correct day title.

here is the actionscript i have so far;
ActionScript Code:
stop (); Stage.showMenu = false; // setup needed date variables currentDate = new Date(); currentYear = currentDate.getFullYear(); currentMonth = currentDate.getMonth(); currentDay = currentDate.getDate(); currentDayNum = currentDate.getDay(); // define some arrays to handle date information monthName = new Array(); numDays = new Array(); dayName = new Array(); // handle February on a Leap Year if (currentMonth == 1){     if ((currentYear%4) == 0){         numDays[1] = 29;       } else {         numDays[1] = 28       } }; // define how many days in each month numDays[0] = 31; // February handled by above if statement numDays[2] = 31; numDays[3] = 30; numDays[4] = 31; numDays[5] = 30; numDays[6] = 31; numDays[7] = 31; numDays[8] = 30; numDays[9] = 31; numDays[10] = 30; numDays[11] = 31; // define names of the month monthName[0] = "JANUARY"; monthName[1] = "FEBRUARY"; monthName[2] = "MARCH"; monthName[3] = "APRIL"; monthName[4] = "MAY"; monthName[5] = "JUNE"; monthName[6] = "JULY"; monthName[7] = "AUGUST"; monthName[8] = "SEPTEMBER"; monthName[9] = "OCTOBER"; monthName[10]= "NOVEMBER"; monthName[11]= "DEVEMBER"; // define the names of each day dayName[0] = "SUN"; dayName[1] = "MON"; dayName[2] = "TUE"; dayName[3] = "WED"; dayName[4] = "THU"; dayName[5] = "FRI"; dayName[6] = "SAT"; // set some positioning parameters yStartPos = 0; xStartPos = 515; xSpacing = 51.5; ySpacing = 83; cCount = 0; // counts number of columns rCount = 0; // counts number of rows dCount = 0; // counts number of days //build the months worth of days this.onEnterFrame = function() {     if (dCount < numDays[currentMonth]) {         var dayClip = dayHolder.attachMovie ("dayBox", "dayBox" + dCount, dCount);         dayTween = new mx.transitions.Tween(dayClip, "_alpha", mx.transitions.easing.Strong.easeOut, 0, 100, 2.5, true);         dayTweenX = new mx.transitions.Tween(dayClip, "_width", mx.transitions.easing.Regular.easeOut, 0, 100.2, 1, true);         dayTweenY = new mx.transitions.Tween(dayClip, "_height", mx.transitions.easing.Regular.easeOut, 0, 81, 1, true);         dayClip.dayText.text = dCount+1;         if (cCount > 1 && (cCount%7)==0){             cCount = 0;             rCount++;         }         if (dCount == 0) {             dayClip._x = xStartPos;             cCount = 6; // needs to eventually be changed with first day of the month variable             dCount++;                     } else {             dayClip._x = cCount++ * xSpacing;             dayClip._y = rCount * ySpacing;             cCount++;             dCount++;         }         } else {         delete this.onEnterFrame;         } };

I hard set the _x starting position that works for the month of June but i would need to replace that with another variable once i figure out how to automatically determine the 1st day of any month and use a corresponding array to set the _x positions for any of the 7 possible starting days.

does anyone have some suggestions?
PibbTibbs is offline   Reply With Quote
Old 06-14-2007, 01:53 AM   #2
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

http://www.actionscript.org/forums/s...&postcount=191
atomic is offline   Reply With Quote
Old 06-14-2007, 02:19 AM   #3
PibbTibbs
Registered User
 
Join Date: Apr 2007
Location: Canada
Posts: 42
Default

these are fantastic, thanks. I was kind of hoping to get through as much as possible on my own, without relying too much on other peoples work. I got hung up on this seemingly simple issue's and started to go bonkers.

But now that i have seen these i may find it hard to resist the temptation to use one of them.
PibbTibbs is offline   Reply With Quote
Old 06-14-2007, 02:32 AM   #4
atomic
Banned by AS.org Staff
 
Join Date: Jan 2007
Location: Montréal, Québec
Posts: 14,073
Default

There's more...

http://www.actionscript.org/forums/s...&postcount=192

And in case you want to go through the 22 pages thread...

http://www.actionscript.org/forums/s....php3?t=110747
atomic is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash XML Event Calendar anam28 Components 0 04-20-2007 06:30 PM
creating an event calendar with Flash 8? seafury500 ActionScript 2.0 0 09-04-2006 06:06 PM
Can someone look at this calendar code, changing month is messed up. Hofmann ActionScript 2.0 8 10-03-2004 07:10 AM
calendar component, month disappears boneheaded ActionScript 1.0 (and below) 0 09-16-2002 08:02 PM
Event handling with Listeners - learning from Java robertpenner ActionScript 1.0 (and below) 2 08-08-2001 11:36 PM


All times are GMT. The time now is 07:11 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.