Welcome, Guest. Please login or register.
Did you miss your activation email?
02/08/12, 08:08
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  Server side Scripting and Database Support
| |-+  Web Services: XML, Soap, WSDL, UDDI, and Flash Integration (Moderators: Flash-db, Musicman, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  Problems to show an xml file in a nested swf
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Problems to show an xml file in a nested swf  (Read 3521 times)
hellblazer
Server what's that
*
Posts: 2


View Profile Email
« on: 06/20/09, 13:11 »

Hello Everybody!

I need some help with this issue.
I have a swf that loads a xml file with text.
This is the code:

System.useCodepage = true;

var indice:Number;

var noticias_xml:XML;


function cargarDatos(_indice:Number){
      var fecha:String;
      var titulo:String;
      var mensaje:String;
      var imagen:String;
      
      fecha = noticias_xml.firstChild.childNodes[_indice].attributes.fecha;
      
      titulo = noticias_xml.firstChild.childNodes[_indice].firstChild.firstChild.nodeValue;
      
      mensaje = noticias_xml.firstChild.childNodes[_indice].firstChild.nextSibling.firstChild.nodeValue
      
      imagen = noticias_xml.firstChild.childNodes[_indice].lastChild.firstChild.nodeValue
      
      _root.mensaje_txt.htmlText = "";
      _root.mensaje_txt.htmlText += "<p align='center'><font color='#006633' size='12'><b>" + titulo + "</b></font></p>";
      _root.mensaje_txt.htmlText += "<p><font size='10'>" + mensaje + "</font>";
      _root.mensaje_txt.htmlText += "<font color='#666666' size='10'>Publicado: " + fecha + "</font></p>";
      _root.pantalla_mc.loadMovie(imagen);   
   }

siguiente_btn.onPress = function(){   
   if(noticias_xml.firstChild.childNodes[indice+1] != null){
         indice++;
         cargarDatos(indice);
         }
   }

anterior_btn.onPress = function(){
   if(noticias_xml.firstChild.childNodes[indice-1] != null){
         indice--;
         cargarDatos(indice);
         }
   }   
   
indice=0; //inicializando indice en 0 para mostrar la primera noticia

noticias_xml = new XML();

noticias_xml.ignoreWhite = true;

noticias_xml.load("/html/prueba/noticias.xml");

noticias_xml.onLoad = function(){
         
         cargarDatos(indice);         
   }


This work perfect! but when I load this swf (noticiasnew.swf) in the main swf (indexnou8ok.swf) with:

on (release) {loadMovie("noticiasnew.swf", _root.pelicula);
}


The text of the xml file doesn't appear.
The question is: What do I need to change to see the content of that xml file when the "noticiasnew.swf" file is nested in "indexnou8ok.swf"?
Logged
Ronald Wernecke
Administrator
Systems Administrator
*****
Posts: 6162


View Profile WWW Email
« Reply #1 on: 06/21/09, 03:29 »

This section is not right anymore, because path has changed Wink

 _root.mensaje_txt.htmlText = "";
      _root.mensaje_txt.htmlText += "<p align='center'><font color='#006633' size='12'><b>" + titulo + "</b></font></p>";
      _root.mensaje_txt.htmlText += "<p><font size='10'>" + mensaje + "</font>";
      _root.mensaje_txt.htmlText += "<font color='#666666' size='10'>Publicado: " + fecha + "</font></p>";
      _root.pantalla_mc.loadMovie(imagen);   

replacing _root with this should do the trick
Logged

happy flashing
Cool
Ronald
hellblazer
Server what's that
*
Posts: 2


View Profile Email
« Reply #2 on: 06/22/09, 08:53 »

Ronald,

YOU ARE A GENIUS!!!!!!
Thank you very much for your help!!!!
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!