2005/05/04 | AS练习——万年历
类别(FLASH动画) | 评论(0) | 阅读(179) | 发表于 10:48


onLoad = function () {
jx = 23;
jy = 90;
m = [];
thisday = [];
n = [];
xqw = ['日', '一', '二', '三', '四', '五', '六'];
sxw = ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"];
createEmptyMovieClip("fk", 10000);
with (fk) {
lineStyle(0, 0xffffff, 0);
beginFill(0xFFFF00, 60);
moveTo(0, 0);
lineTo(15, 0);
lineTo(15, 15);
lineTo(0, 15);
endFill();
}
for (x=0; x<12; x++) {
for (y=0; y<7; y++) {
createTextField("bt"+y, 1000-y-x*20, jx+y*12+(x%6)*90, jy+Math.floor(x/6)*139, 13, 15);
myformat = new TextFormat();
myformat.color = 0x000000;
myformat.size = 10;
myformat.bold = 1;
this["bt"+y].text = xqw[y];
this["bt"+y].setTextFormat(myformat);
}
}
};
onEnterFrame = function () {
sj = new Date();
a = sj.getHours();
b = sj.getMinutes();
c = sj.getSeconds();
d = sj.getDate();
e = sj.getMonth();
yue = e+1;
f = sj.getFullYear();
g = sj.getDay();
for (j=1; j<=12; j++) {
if ((j == 1) || (j == 3) || (j == 5) || (j == 7) || (j == 8) || (j == 10) || (j == 12)) {
m[j] = 31;
} else if ((j == 4) || (j == 6) || (j == 9) || (j == 11)) {
m[j] = 30;
} else if ((f%4 == 0) && (f%100<>0) || (f%400 == 0)) {
m[j] = 29;
} else {
m[j] = 28;
}
thisday[j] = new Date(f, j-1, 1);
for (i=1; i<=m[j]; i++) {
n[j] = thisday[j].getDay()+i-1;
createTextField("rq"+j+"yue"+i, 20000-j*100-i, jx+(n[j]%7)*12+((j-1)%6)*90, jy+(Math.floor(n[j]/7)+1)*15+139*(Math.floor(j/7)), 15, 15);
myformat1 = new TextFormat();
if (i == d && j == yue) {
myformat1.color = 0xFF00FF;
} else if ((n[j]%7 == 0) || (n[j]%7 == 6)) {
myformat1.color = 0xFF0000;
} else {
myformat1.color = 0x000000;
}
myformat1.size = 10;
myformat1.bold = 1;
this["rq"+j+"yue"+i].text = i;
this["rq"+j+"yue"+i].setTextFormat(myformat1);
}
_root.fk._x = this["rq"+yue+"yue"+d]._x;
_root.fk._y = this["rq"+yue+"yue"+d]._y;
if (length(j) == 1) {
yf = " "+j;
} else {
yf = j;
}
createTextField("yuefen"+j, 100-j, jx+((j-1)%6)*90, jy+(Math.floor(j/7))*139, 80, 80);
myformat5 = new TextFormat();
myformat5.color = 0xCCCCCC;
myformat5.size = 70;
myformat5.bold = 1;
this["yuefen"+j].text = yf;
this["yuefen"+j].setTextFormat(myformat5);
}
sx = (f-1996)%12;
createTextField("wz1", 2000, 170, 30, 300, 50);
myformat2 = new TextFormat();
myformat2.color = 0x000000;
myformat2.size = 40;
myformat2.bold = 1;
wz1.text = sxw[sx]+"年"+f+"年";
wz1.setTextFormat(myformat2);
if (length(a) == 1) {
aa = "0"+a;
} else {
aa = a;
}
if (length(b) == 1) {
bb = "0"+b;
} else {
bb = b;
}
if (length(c) == 1) {
cc = "0"+c;
} else {
cc = c;
}
createTextField("wz2", 2001, 80, 340, 400, 50);
myformat3 = new TextFormat();
myformat3.color = 0x000000;
myformat3.size = 30;
myformat3.bold = 1;
wz2.text = "现在时刻 "+aa+":"+bb+":"+cc;
wz2.setTextFormat(myformat3);
createTextField("wz3", 20012, 405, 350, 400, 50);
myformat4 = new TextFormat();
myformat4.color = 0x000000;
myformat4.size = 23;
myformat4.bold = 1;
wz3.text = String.fromCharCode(23637, 32701, 21046, 20316);
wz3.setTextFormat(myformat4);
};
0

评论Comments