Flash calendar (as3)
[ 2009-04-07 19:00:36 | Author: liuhuan ]
It's easy to use calendar in older flash version, since there is a Calendar component which is powerful and convinient.
For Flash CS3 and later versions, flash does not provide calendar component anymore. I don't know why. However, i made one myself.
The essential functions used in flash calendar are:
1. judge whether the year is olympic or normal. Just simply divide the year into 4:
2. get the start day in a certain month. It's simple to get it using the getDay() function in actionscript.
The rest jobs are easy. You can download the source file here:
Click Here To Download
For Flash CS3 and later versions, flash does not provide calendar component anymore. I don't know why. However, i made one myself.
The essential functions used in flash calendar are:
1. judge whether the year is olympic or normal. Just simply divide the year into 4:
private function daysMonth(month:Number, year:Number):Number {
var tmp:Number = year % 4;
if (tmp == 0) {
return (monthdaysOlympic_arr[month]);
} else {
return (monthdaysNormal_arr[month]);
}
}
var tmp:Number = year % 4;
if (tmp == 0) {
return (monthdaysOlympic_arr[month]);
} else {
return (monthdaysNormal_arr[month]);
}
}
2. get the start day in a certain month. It's simple to get it using the getDay() function in actionscript.
private function dayStart(month:Number, year:Number):Number {
var tmpDate:Date = new Date(year, month, 1);
return (tmpDate.getDay());
}
var tmpDate:Date = new Date(year, month, 1);
return (tmpDate.getDay());
}
The rest jobs are easy. You can download the source file here:
Click Here To Download
Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=968
There is no comment on this article.
You can't post comment on this article.