D L M X J V S
Me gustaria que el primer día que tomara fuera el lunes y no el domingo.
El código es el siguiente, a ver si alguien me puede ayudar:
Código :
this._lockroot = true;
// which day of week does the month begin on
juliandate = Number(Number(Number(367*myyear-int(7*(Number(myyear)+Number(int((Number(mymonth)+9)/12)))/4))+Number(int((275*mymonth)/9)))+1)+1721013.5;
mjd = juliandate-2400000.5;
whichday = mjd-int(mjd/7)*7;
whichday = Number(whichday)+3;
if (Number(whichday)>=7) {
whichday = whichday-7;
}
// initialize day and row variables
counter = 2;
currentday = Number(whichday)+1;
currentrow = 0;
daysinmonth = eval("month" add mymonth);
// check for leap year
if (Number(int(myyear/4)) == Number((myyear/4)) and Number(mymonth) == 2) {
daysinmonth = 29;
}
//initialize day1
if(_root.yearNode_xml==0 || _root.monthNode_xml==0){
_root.dayNode_xml=0;
}
else{
_root.dayNode_xml=monthNode_xml.firstChild;
_root.dayNode_xml=setDay(_root.dayNode_xml,1,"square1");
}
//set day1 values
while (Number(counter)<=Number(daysinmonth)) {
// end of week? start new row
if (Number(currentday) == 7) {
currentday = 0;
currentrow = Number(currentrow)+1;
}
// duplicate square for each day in month and move to correct position and intialize values
duplicateMovieClip("/square1", "square" add counter, counter);
setProperty("/square" add counter, _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*currentday));
setProperty("/square" add counter, _y, Number(getProperty("/square1", _y))+Number(getProperty("/square1", _height)*currentrow));
set("/square" add counter add ":daynum", counter);
_root.dayNode_xml=setDay(_root.dayNode_xml,counter,"square"+counter);
counter = Number(counter)+1;
currentday = Number(currentday)+1;
}
// move first day into right spot
setProperty("/square1", _x, Number(getProperty("/square1", _x))+Number(getProperty("/square1", _width)*whichday));
// highlight current day
if((_root.myyear==_root.todayYear)&&(_root.mymonth==_root.todayMonth)){
var mc="square"+myday;
_root[mc].daynum_txt.textColor=_root.myColorAS;
}
// month title
monthtitle = eval("namemonth" add mymonth) add " " add myyear;
trace("MONTHTITLE: " + monthtitle);
_root.monthtitle_txt.text=monthtitle;
_root.monthtitle_txt.textColor=_root.myColorAS;
Muchas gracias
