Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/07/2006, 12:03
imnotinsane
 
Fecha de Ingreso: mayo-2006
Mensajes: 64
Antigüedad: 18 años
Puntos: 0
Por fin lo consegui, pero ahora tengo el problema de que en IE se ven las noticias sin problemas pero no en firefox...

este es el codigo flash :

Código:
var noticias_xml:XML = new XML();
noticias_xml.ignoreWhite = true;
noticias_xml.onLoad = function(ok){
	//si se logro cargar llamamos a la funcion 'listar_noticias' pasandole como parámetros
	//la lista de hijos nodo del nodo principal
	if(ok) listar_noticias(this.firstChild.childNodes);
	//si no se cargó correctamente, informamos
	else trace('no se cargó correctamente');
}

noticias_xml.load('noticias.php');

listar_noticias = function(noticias:Array):Void{
	//modificamos las propiedades del campo de texto para que funcione como queremos

	//exploramos cada elemento del array 'noticias' que recibimos como parametro
	//y vamos agregando dentro del campo de texto dandole formato HTML
	
		titulo1.htmlText = noticias[0].attributes.titulo;
		texto1.htmlText = noticias[0].attributes.texto;
		fecha1.htmlText = noticias[0].attributes.fecha;
	
}
stop();
Y este el codigo php

Código:
<?php
$dbhost = "localhost" ;
$dbuser = "root" ;
$dbpass = "" ;
$db = "noticias" ;
$conectar = mysql_connect($dbhost,$dbuser,$dbpass) ; mysql_select_db($db,$conectar) ;


$resp = mysql_query("select id,fecha,titulo,texto FROM noticias ORDER BY id desc") ;

		
$xml = '';
$xml .= '<?xml version="1.0" encoding="UTF-8"?>'."\n"; 
$xml .= '<noticias>';  

while ($datos = mysql_fetch_array($resp)) { 

        $fecha = $datos[fecha] ;
        $mesesano = array("01","02","03","04","05","06","07","08",
        "09","10","11","12") ;
        $diames = date(j,$fecha) ; $mesano = date(n,$fecha) - 1 ; $ano = date(Y,$fecha) ;
        $fecha = "$diames/$mesesano[$mesano]/$ano" ;
		
		$xml .= "\n\t".'<noticia id="'.$datos['id'].'" fecha="'.$fecha.'" titulo="'.$datos['titulo'].'" texto="'.$datos['texto'].'" />';
}
$xml .= "\n</noticias>";  
echo $xml; 

?>