Comunidad de diseño web y desarrollo en internet online

Codigo Calendario de AS2 a AS3

Citar            
MensajeEscrito el 06 Abr 2010 06:26 am
Hola a todos, desde hace años visitando este sitio y hasta hoy me registro.
Necesito traducir este código as2 a as3, he buscado ejemplos de calendarios AS3, pero no he encontrado alguno que sea similar, este utiliza Movie clips para desplegar el numero del día y así se puede personalizar bastante el diseño. Por su ayuda gracias… :D

Código ActionScript :

stop();
System.useCodepage = true;
raiz_url = "";
baselink = "";
datos = new Array();
meses = new Array("ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE");
var hoy:Date = new Date();

var today:Date = new Date();
todayDay = today.getDate();
todayMonth = today.getMonth();
todayYear = today.getFullYear();


if (_level0.date != undefined) {
   fechaU = _level0.date.split("-");
   hoy.setMonth(fechaU[1]-1);
}
function clearDay() {
   loader_mc._visible = true;
   for (i=1; i<38; i++) {
      if (i<10) {
         indi = "0"+i;
      } else {
         indi = i;
      }
      this[indi]._alpha = 100;
      this[indi]._visible = false;
   }
}
clearDay();
function lastDayInMonth(year:Number, month:Number, date:Date):Number {
   var nDate:Date = (!date) ? new Date(year, month, 31) : new Date(date.getFullYear(), date.getMonth(), 31);
   return (nDate.getMonth() == month) ? 31 : 31-nDate.getDate();
}
function firstDayInWeek(anio, mes) {
   var diaUno:Date = new Date(anio, mes, 1);
   return diaUno.getDay();
}
function draw_calendar(array_data) {
   //vinculos_txt.htmlText="";
   for (i=1; i<38; i++) {
      if (i<10) {
         ind = "0"+i;
      } else {
         ind = i;
      }
      if (i<primerDiaSemana || i-primerDiaSemana+1>diasMes) {
         this[ind]._visible = false;
      } else {
         this[ind].activo_mc._visible = false;
         this[ind].texto_links_dia = "";
         this[ind]._visible = true;
         this[ind].restoDia_mc.nDia_txt.text = i-primerDiaSemana+1;
         //today
         if(this[ind].restoDia_mc.nDia_txt.text==todayDay && hoy.getMonth() == todayMonth && hoy.getFullYear() == todayYear){ this[ind].marcahoy_mc._visible = true; }else{this[ind].marcahoy_mc._visible = false;}
         //
         var elanio = anio_txt.text;
         var elmes;
         var eldia = this[ind].restoDia_mc.nDia_txt.text;
         if(eldia<10) eldia= "0"+eldia;
         if((hoy.getMonth()+1)<10)elmes= "0"+(hoy.getMonth()+1);
         this[ind].linkdia= baselink+"/cartelera/day/"+elanio+elmes+eldia;
      }
   }
}
function generaMes() {
   clearDay();
   mes = hoy.getMonth();
   anio = hoy.getFullYear();
   diasMes = lastDayInMonth(anio, mes);
   primerDiaSemana = firstDayInWeek(anio, mes);
   if (primerDiaSemana == 0) {
      primerDiaSemana = 7;
   }
   nombreMes_txt.text = meses[mes];
   anio_txt.text = anio;
   mesC = mes+1;
   if (mesC<10) {
      mesC = "0"+mesC;
   }
   draw_calendar(datos);
}
generaMes();
/*----------------------------Botones del mes----------------------------------------*/
mesAtras_btn.onRelease = function() {
   mesActual = hoy.getMonth();
   restaActual = mesActual-1;
   hoy.setMonth(restaActual);
   mes = hoy.getMonth();
   generaMes();
};
mesAdelante_btn.onRelease = function() {
   actualMes = hoy.getMonth();
   sumaMes = actualMes+1;
   hoy.setMonth(sumaMes);
   mes = hoy.getMonth();
   generaMes();
};

Por VictorE

4 de clabLevel



 

Mexico

chrome
Citar            
MensajeEscrito el 07 Abr 2010 05:53 pm

Por VictorE

4 de clabLevel



 

Mexico

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.