Comunidad de diseño web y desarrollo en internet online

calendario con evento de imagen dede un xml

Citar            
MensajeEscrito el 15 Nov 2007 10:25 pm
Tengo el siguiente problema:
Tengo un script de un calendario con eventos tomados desde un archivo XML.
Los eventos se muestran en un textfield.
Ahora necesito mostrar en cada evento una imagen en vez de texto.
Por mucho que lo he intentado no consigo crear el as ni tampoco el xml.
Lo necesito para la página web del colegio y lo que quiero es que, al pinchar en el día que se desee, aparezca la imagen del menú de ese día. Es una imagen para no tener que escribir el menú en el archivo XML.
Les paso el archivo del calendario y el Xml por si alguien puede aconsejarme.

Código :

//codificacion de los textos
_lockroot=true;
System.useCodepage = true;
//Separaciones de las filas y columnas
_global.xSep   = 30;
_global.ySep   = 20;

MovieClip.prototype.dibujarCuadrado = function(x,y,ancho,alto,borde,colorBorde,alphaBorde,colorRelleno,alphaRelleno){
   with(this){
      lineStyle(borde, colorBorde, alphaBorde);
      beginFill(colorRelleno,alphaRelleno);
      moveTo(x,y);
      lineTo(x+ancho,y);
      lineTo(x+ancho,y+alto);
      lineTo(x,y+alto);
      lineTo(x,y);
      endFill();
   }
}
Calendario = function(x,y, d, m, a){
   this.dia   = d;
   this.mes   = m;
   this.anyo   = a;
   this.eventos   = _global.nEventos;
   this.x      = x;
   this.y      = y;
   primeranyo = 2005; //Primer año que se muestra
   ultimoanyo = 2008; //ultimo año que se muestra
}
Calendario.prototype.pintaCalendario = function(){
   listaDias    = new Array('Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab', 'Dom');
   listaMeses   = new Array('ENERO', 'FEBRERO', 'MARZO', 'ABRIL', 'MAYO', 'JUNIO', 'JULIO', 'AGOSTO', 'SEPTIEMBRE', 'OCTUBRE', 'NOVIEMBRE', 'DICIEMBRE');
   _root.createEmptyMovieClip("cal",10);
   _root.attachMovie( "fondo", "fondo", 9);

   //posicion del calendario
   _root.cal._x = _root.fondo._x;
   _root.cal._y = _root.fondo._y;

   /*********************************
   * Lunes-Domingo
   **********************************/
   // el formato de la fuente que usemos para los días de la semana
   format = new TextFormat();
   format.font = "Verdana";
   format.size = 9;
   format.bold = true;
   format.color = 0x0066ff;
   format.align="center";
   format.indent=1
   otroformat = new TextFormat();
   otroformat.font = "Verdana";
   otroformat.size = 9;
   otroformat.bold = true;
   otroformat.color = 0xff0000;
   otroformat.align="center";
   otroformat.indent=1
   for(i = 0;i < listaDias.length;i++){
      _root.cal.createTextField(listaDias[i].toLowerCase(),20+i,i*_global.xSep+8,40,35,20);
      _root.cal[listaDias[i]].text = listaDias[i];
      _root.cal[listaDias[i]].text.selectable = false;
      _root.cal[listaDias[i]].text.embedFonts = true;
      _root.cal[listaDias[i]].setTextFormat(format);
      
   }
   if(i=6){
      //Dom en rojo
      _root.cal[listaDias[i]].setTextFormat(otroformat);
      //_root.cal[listaDias[i]].aplicarFormato("Verdana",0xff0000,9,true,"center");
      
   }
   /*********************************
   * dias del mes
   **********************************/
   //formato dias del mes
   diaformat = new TextFormat();
   diaformat.font = "Verdana";
   diaformat.size = 9;
   diaformat.bold = false;
   diaformat.color = 0x0066ff;
   diaformat.align="center";
   diaformat.indent=1
   inicioMes = new Date(this.anyo, this.mes-1,1);
   iniSemana = inicioMes.getDay();
   if(iniSemana == 0) {
      iniSemana = 6;
      
   }else{
      iniSemana = iniSemana - 1;
      
   }   
   xPos   = iniSemana;
   yPos   = 0;
   if(this.mes == 1 or this.mes == 3 or this.mes == 5 or this.mes == 7 or this.mes == 8 or this.mes == 10 or this.mes == 12){
      totalDias = 31;
   }else if(this.mes == 2){
      if((this.anyo % 4 == 0 && this.anyo % 100 != 0) or this.anyo % 400 == 0){
         totalDias = 29;
      }else{
         totalDias = 28;
      }
   }else{
      totalDias = 30;
   }
   ahora = new Date();
   for(i = 1;i <= totalDias; i++){
      _root.cal.createTextField("dia"+i,60+(i*2),(xPos)*_global.xSep+10,_global.ySep+yPos+40,30,20);
      //Cuadrados grises de fondo de cada fecha
      _root.cal.createEmptyMovieClip("fondodefecha"+i,7+20*i);
      _root.cal["fondodefecha"+i].dibujarCuadrado(xPos*_global.xSep+14,_global.ySep+yPos+40,20,15,1,0x3399ff,100,0xEAEAEA,0);
      //********************************
      _root.cal["dia"+i].text = i;
      _root.cal["dia"+i].selectable = false;
      
      if(i == ahora.getDate() && ahora.getMonth() == (this.mes-1) && ahora.getYear() == (this.anyo-1900)){
         //fech actual en rojo
         _root.cal["dia"+i].setTextFormat(otroformat);
      }else{
         _root.cal["dia"+i].setTextFormat(diaformat);;
      }
      /**********************************
      * fecha pinchable
      **********************************/
      fechaformat = new TextFormat();
      fechaformat.font = "Verdana";
      fechaformat.size = 11;
      fechaformat.bold = true;
      fechaformat.color = 0x0066ff;
      fechaformat.align="left";
      fechaformat.indent=1
      for(j = 0;j < this.eventos.length; j++){
         if(this.eventos[j].attributes.dia == i && this.eventos[j].attributes.mes == this.mes && this.eventos[j].attributes.anyo == this.anyo){
            _root.cal.attachMovie( "fondopinchable", "fondopinchable"+j, j );
            _root.cal["fondopinchable"+j]._x = xPos*_global.xSep+13;
            _root.cal["fondopinchable"+j]._y = _global.ySep+yPos+40;
            _root.cal["fondopinchable"+j].evento = this.eventos[j];
            _root.cal["fondopinchable"+j].onPress = function(){
               _root.cal.info.htmlText = this.evento.firstChild.toString();
               //formato del campo de texto info
               _root.cal.info.setTextFormat(fechaformat);;
            }
         }      
      }
      xPos++;
      if(xPos % 7 == 0){
         xPos = 0;
         yPos += _global.ySep;
      }   
   }
   /********************************
   * nombre del mes y año
   *********************************/
   _root.fondo.mesanyo.text = listaMeses[inicioMes.getMonth()]+", "+this.anyo;
   
   /***************************************
   * se crean los botones de avance y retroceso de mes y año
   ***************************************/   
   //mas
   if(_root.d.anyo<ultimoanyo){
   _root.fondo.mas.onPress = function(){
      _root.d.mes++;
      if(_root.d.mes > 12){ _root.d.anyo++;_root.d.mes = 1;}
      _root.d = new calendario(_root.d.x, _root.d.y, 1,_root.d.mes,_root.d.anyo);
      _root.d.pintaCalendario();
   }
   }
   //menos
   if(_root.d.anyo>=primeranyo+1){
   _root.fondo.menos.onPress = function(){
      _root.d.mes--;
      if(_root.d.mes <= 0){ _root.d.anyo--;_root.d.mes = 12;}
      _root.d = new calendario(_root.d.x, _root.d.y,1,_root.d.mes,_root.d.anyo);
      _root.d.pintaCalendario();
   }
   }
   
   /*************************************
   * textfield info con la informacion que tiene el xml
   *************************************/
   _root.cal.createTextField("info",7000,12,197,210,68);
   _root.cal.info.multiline = true;
   _root.cal.info.html = true;
   _root.cal.info.wordWrap = true; //Ajuste de texto
   _root.cal.info.autoSize = true; //Se muestra completo
   _root.cal.info.selectable = false; //texto seleccionable, pues que no.
   _root.cal.info.text.embedFonts = true;
}
cargaXml = function(fichero){
   doc = new XML();
   doc.ignoreWhite = true;
   doc.load(fichero);
   var nEventos = new Array();
   doc.onLoad = function(){
      _global.nEventos = doc.firstChild.childNodes;
      //Comienzo del calendario:
      var inicio = new Date();
      this.anio = inicio.getFullYear();
      this.mez = inicio.getMonth()+1;
      /*Si quieres que inicialmente el calendario muestre un mes determinado
      de cualquier año, sustituye en el siguiente renglón los parámetros 
      this.mez por el número del mes (ej: octubre = 10)
      y this.anio por el número del año (ej: 2007), 
      Si no lo haces mostrará el mes en curso*/
      d = new calendario(150,150,27,this.mez,this.anio);
      d.pintaCalendario();
   }
}
   /*************************************
   * Leer el xml
   *************************************/
cargaXml("calendario.xml");

Y este es el archivo XML

Código :

<?xml version="1.0" encoding="utf-8"?>
<calendario>
   <evento dia = "15" mes = "10" anyo = "2006"> tomate</evento>
   <evento dia = "19" mes = "10" anyo ="2006"> hola que tal</evento>
   <evento dia = "28" mes = "10" anyo = "2006">evento 2</evento>
   <evento dia = "11" mes = "11" anyo = "2006">evento 2a</evento>
   <evento dia = "15" mes = "12" anyo = "2006">evento 3</evento>
   <evento dia = "2" mes = "1" anyo = "2007">evento 4</evento>
</calendario>

Qué debo de cambiar para poder susituir el texto del XML por una imagen .
Les agradezco su ayuda de antemano.
Un saludo

Por julio.numerotrece

19 de clabLevel



 

Madrid

firefox
Citar            
MensajeEscrito el 27 Ago 2008 09:22 am
Hola se que no estoy dando respuesta a tu pregunta, pero, se que tu puedes dar respuesta a la mia.. llevo días tratando de hacer un calendario pero simplemente no le atino... veo que tu ya lo tienes hecho y quisiera abusar de tu ayuda preguntando si me puedes pasar los originales para saber como los has hecho..

espero que puedas ayudarme :wink:

Por suale

1 de clabLevel



 

firefox

 

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