;

PDA

Click to See Complete Forum and Search --> : News and images with XML


byweb
04-10-2007, 06:59 AM
I am trying to do a newscaster with images by means of file XLM. I have a code, but in KoolMoves it doesnīt work.
Why ?, Because probably the code is AS2.
The code is :

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;
noticias_xml = new XML();
noticias_xml.ignoreWhite = true;
noticias_xml.load("noticias.xml");
noticias_xml.onLoad = function() {
cargarDatos(indice);
};

That it is necessary to change in order that the code works in KoolMoves ?
Thanks, I donīt know to change the code AS2 to AS1.

Bob Hartzell
04-10-2007, 08:40 AM
It definitely is not AS1 and that is the problem.

blanius
04-10-2007, 10:06 AM
It might be enough to change

var indice:Number;
var noticias_xml:XML;
function cargarDatos(_indice:Number) {
var fecha:String;
var titulo:String;
var mensaje:String;
var imagen:String;


To

var indice;
var noticias_xml;
function cargarDatos(_indice) {
var fecha;
var titulo;
var mensaje;
var imagen;

byweb
04-11-2007, 07:39 AM
Thank you for your response friend blainus, now it works perfectly. Thank you again. Here I leave the file for if it helps someone. Now I am working for that appear five news and images in window. Thanks