Comunidad de diseño web y desarrollo en internet online

PROBLEMA CON XML Y CSS

Citar            
MensajeEscrito el 26 Nov 2008 03:30 pm
Buenas, estoy apenas comenzando a meterme con xml y css estoy tratando de aplicar unos estilos al xml y cargar este ultimo en flash en una caja de texto que esta dentro de un movie clip pero no he podido, mi codigo esta así:

xml:


Código :

<?xml version="1.0" encoding="iso-8859-1"?>
<;?xml-stylesheet type= "text/css" href="estilos.css"?>;
<diseno>
   <titulo>Programa de Diseño Visual</titulo>
   <texto>esto es un ensayo</texto>
   <WEB URL="http://www.imdb.com/title/tt0103874/">imdb.com</WEB>
</diseno>


mi css:

Código :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
</head>

<body>
.titulo {
  color: #C92725;
  font-family: Georgia;
  font-size: 18px;
  font-weight:bold;
  text-align:center; 
  display: inline;
}
.subtitulo {
  color: #C92725;
  font-family: Georgia;
  font-size: 15px;
  font-weight:normal;
  text-align:left; 
  display: inline;
}
a:link {
  color: #CCCCCC;
  font-family: Georgia;
  text-decoration:none;
  font-size: 16px;
  font-weight:bold;
  text-align:left; 
  }
a:hover{
  color: #C92725;
  font-family: Georgia;
  text-decoration: none;
  font-size: 16px;
  font-weight:bold;
  text-align:left; 
  }
  .contenido {
  color: #000000;
  font-family: Arial,Helvetica,sans-serif;
  font-size: 14px;
  font-weight:normal;
  text-align:justify;
  display: block;<br />
  }
  
</body>
</html>


y en flash:

Código :

_root.grande_mc;
var miXml:XML = new XML(); 
miXml.ignoreWhite = true; 

miXml.onLoad = function(exito) 
{ 
   if (exito) 
   { 
      tit_txt = diseno.firstChild.childNodes[0].firstChild;
      tit_txt = diseno.firstChild.childNodes[1].firstChild;
     tit_txt = diseno.firstChild.childNodes[2].firstChild;
     
   } 
   else 
   { 
      errorTXT.htmlText = "Error en la carga del texto"; 
   } 
} 

obj_xml.load("diseno.xml");


Debo estar cometiendo muchos errores, de esto me falta muuuuuucho por aprender, al que me pueda colaborar muchas gracias... :oops:

Por alejilla

Claber

120 de clabLevel



Genero:Femenino  

Colombia

firefox
Citar            
MensajeEscrito el 26 Nov 2008 04:32 pm
Tu XML todo en minusculas.

Código XML :

<?xml version="1.0" encoding="iso-8859-1"?>
<;?xml-stylesheet type= "text/css" href="estilos.css"?>;
<diseno>
   <titulo>Programa de Diseño Visual</titulo>
   <texto>esto es un ensayo</texto>
   <web url="http://www.imdb.com/title/tt0103874/">imdb.com</web>
</diseno>



Tu CSS sin encabezados y etiquetas de HTML
mi css:

.titulo {
color: #C92725;
font-family: Georgia;
font-size: 18px;
font-weight:bold;
text-align:center;
display: inline;
}
.subtitulo {
color: #C92725;
font-family: Georgia;
font-size: 15px;
font-weight:normal;
text-align:left;
display: inline;
}
a:link {
color: #CCCCCC;
font-family: Georgia;
text-decoration:none;
font-size: 16px;
font-weight:bold;
text-align:left;
}
a:hover{
color: #C92725;
font-family: Georgia;
text-decoration: none;
font-size: 16px;
font-weight:bold;
text-align:left;
}
.contenido {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 14px;
font-weight:normal;
text-align:justify;
display: block;<br />
}


Tu AS parece bien pero tendria que checarlo .

Código ActionScript :

_root.grande_mc;
var miXml:XML = new XML(); 
miXml.ignoreWhite = true; 

miXml.onLoad = function(exito) 
{ 
   if (exito) 
   { 
      tit_txt = diseno.firstChild.childNodes[0].firstChild;
      tit_txt = diseno.firstChild.childNodes[1].firstChild;
     tit_txt = diseno.firstChild.childNodes[2].firstChild;
     
   } 
   else 
   { 
      errorTXT.htmlText = "Error en la carga del texto"; 
   } 
} 

obj_xml.load("diseno.xml");


Empieza probando estos cambios, por cierto a donde mandas llmaar el CSS?
Saludos

Por flashreloco

Claber

1310 de clabLevel

1 tutorial
1 articulo

Genero:Masculino  

Webdesigner & Mandilon 2.0

msie
Citar            
MensajeEscrito el 26 Nov 2008 05:36 pm
Supuestamente en esta linea?

Código :

<;?xml-stylesheet type= "text/css" href="estilos.css"?>; 


tiene 2 puntoycomas que no se que carajo y además debería llamarse del flash, no?

Por tomasdev

220 de clabLevel

1 tutorial

 

Argentina por ahora...

firefox
Citar            
MensajeEscrito el 27 Nov 2008 03:17 pm
Ya cambie todo lo que me dijiste, además jale el css a flas sdegun un tuto que encontré acá en clab, pero no me funciona, no se si estoy poniendo mal el codigo, para incluir el xml tengo en un fotograma:

var miXml:XML = new XML();
miXml.ignoreWhite = true;

miXml.onLoad = function(exito)
{
if (exito)
{
tit_txt = diseno.firstChild.childNodes[0].firstChild;
tit_txt = diseno.firstChild.childNodes[1].firstChild;
tit_txt = diseno.firstChild.childNodes[2].firstChild;

}
else
{
errorTXT.htmlText = "Error en la carga del texto";
}
}

obj_xml.load("diseno.xml");


en otra capa para jalar el css tengo:

var myCSS = new TextField.StyleSheet();
var cssURL = "estilos.css";
myCSS.load(cssURL);
myCSS.onLoad = function(exito) {
if (exito) {
/*Si el el archivo CSS se cargo sin ningun error lo asignamos al
objeto texto "miTexto" y asignamos el texto en HTML
al campo de texto "miTexto.text" */
mi_texto.styleSheet = myCSS;
mi_texto.text = ejemploTexto; //Puede ser un texto html"
}
};

Sin embargo donde dice ejemplo texto supongo que va mi xml pero no se como meterlo...... como lo soluciono? Gracias

Por alejilla

Claber

120 de clabLevel



Genero:Femenino  

Colombia

firefox
Citar            
MensajeEscrito el 27 Nov 2008 04:49 pm

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 27 Nov 2008 05:32 pm
ejemploTexto tiene que ser una variable String... y en tu XML tienes 3 posibles variables... titulo, url y texto. Cada una podría ser asignada a un textfield distinto... o, si lo que piensas es lo que creo.. algo así:

Esto dentro del Onload del XML:

Código :

ejemploTexto = "<p class='titulo'>"+ diseno.firstChild.childNodes[0].firstChild; +"</p><p class='subtitulo'>"+ diseno.firstChild.childNodes[1].firstChild; +"</p><p  class='contenido'>"+ diseno.firstChild.childNodes[2].firstChild; +"</p>";


y creo que debería funcionar, no lo probé y de todos modos no uso AS2, pero debería funcionar no ?

Por tomasdev

220 de clabLevel

1 tutorial

 

Argentina por ahora...

firefox

 

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