Foros del Web » Creando para Internet » Flash y Actionscript »

Convertir array en xml

Estas en el tema de Convertir array en xml en el foro de Flash y Actionscript en Foros del Web. Hola a todos, soy bastante novato en esto y necesitaria de su ayuda, tengo una galeria de imagenes que saque de interet, que toma las ...
  #1 (permalink)  
Antiguo 03/07/2009, 13:59
 
Fecha de Ingreso: diciembre-2008
Mensajes: 23
Antigüedad: 15 años, 4 meses
Puntos: 0
Convertir array en xml

Hola a todos, soy bastante novato en esto y necesitaria de su ayuda, tengo una galeria de imagenes que saque de interet, que toma las imagenes y los titulos de las mismas desde una array en el código actionscript.
A mi me gustaria convertir ese array en un xml, es posible esto? asi puedo agregar la cantirad de fotos que yo quiera sin tener que estar entrando al .fla, si no solamente modificando un xml, ya se a manualmente o desde un formulario en php.

Este es el código del fla:
Código PHP:
/////////////////////////ARRAYS QUE QUIERO CAMBIAR POR XML//////////////////////////////////////////////////////

//This array is where you will enter the folder name and file name of your image.
//You can add as many images as you like and reference them here.
var images:Array = new Array ("galleries/images1/01.jpg","galleries/images1/02.jpg","galleries/images1/03.jpg","galleries/images1/04.jpg","galleries/images1/05.jpg"
                              
,"galleries/images1/06.jpg","galleries/images1/07.jpg","galleries/images1/08.jpg","galleries/images1/09.jpg","galleries/images1/10.jpg"
                              
,"galleries/images1/11.jpg","galleries/images1/12.jpg","galleries/images1/13.jpg");
//This array determines the title for each image, add titles in the same order as your images. 
var titles:Array = new Array ("Image Title 1","Image Title 2","Image Title 3","Image Title 4","Image Title 5",
                              
"Image Title 6","Image Title 7","Image Title 8","Image Title 9","Image Title 10",
                              
"Image Title 11","Image Title 12","Image Title 13");


////No need to edit the rest/////////////////////////////////////////////////////////////////////////// 
var nId:Number = -1;
var 
nIm:Number 0;
desc_txt.html true;
desc_txt.autoSize "left";
total_txt.html true;
total_txt.autoSize "right";

/////////next image function///////////////////////////////////////////////////////////////////////////
function nextImage ():Void {
if (
nId == images.length 1) {
trace ("End");
} else {
nId += 1;
nIm += 1;
_root.attachMovie ("img_mc""img_mc" nImnIm 1);
eval (
_root["img_mc" nIm])._x 0;
eval (
_root["img_mc" nIm])._y 0;
_root.alphaTo (1000"linear"0, function () {
eval (
_root["img_mc" nIm]).mcl.loadClip (images[nId], eval (_root["img_mc" nIm]).loaderMC);});
desc_txt.htmlText = (titles[nId].toUpperCase ());
desc_txt._alpha 0;
desc_txt.alphaTo (1001);
counter addZero ((nId 1), 2);
total addZero (images.length2);
total_txt._alpha 0;
total_txt.alphaTo (1001);
total_txt.htmlText counter "<font color='#555555'>" "/" total "</font>";}}

/////////previous image function///////////////////////////////////////////////////////////////////////////
function prevImg ():Void {
if (
nId <= 0) {
trace ("End");
} else {
nId -= 1;
nIm += 1;
_root.attachMovie ("img_mc""img_mc" nImnIm 1);
eval (
_root["img_mc" nIm])._x 0;
eval (
_root["img_mc" nIm])._y 0;
_root.alphaTo (1000"linear"0, function () {
eval (
_root["img_mc" nIm]).mcl.loadClip (images[nId], eval (_root["img_mc" nIm]).loaderMC);});
desc_txt.htmlText = (titles[nId].toUpperCase ());
desc_txt._alpha 0;
desc_txt.alphaTo (1001);
counter addZero ((nId 1), 2);
total addZero (images.length2);
total_txt._alpha 0;
total_txt.alphaTo (1001);
total_txt.htmlText counter "<font color='#555555'>" "/" total "</font>";}}

/////////add zeros to image counter function///////////////////////////////////////////////////////////////////////////
function addZero (nq):String {
var 
str Math.pow (10, (n.toString ().length)).toString ().substr (1) + n;
return 
str;}
nextImage ();

/////////next and previous button code, calls the functions above///////////////////////////////////////////////////////////////////////////
next_btn.onRelease nextImage;
prev_btn.onRelease prevImg;

/////////sets the next and previous buttons alpha on rollover///////////////////////////////////////////////////////////////////////////
prev_btn.onRollOver next_btn.onRollOver = function () {
this.alphaTo (1001);};
prev_btn.onRollOut next_btn.onRollOut = function () {
this.alphaTo (501);}; 

Ojala hallan entendido la pregunta y me puedan ayudar.

Muchas gracias, saludos
  #2 (permalink)  
Antiguo 03/07/2009, 16:29
 
Fecha de Ingreso: abril-2009
Mensajes: 40
Antigüedad: 15 años
Puntos: 0
Respuesta: Convertir array en xml

Hola amigo. Te recomiendo esto
var titles = new Array();
System.useCodepage = true;
XML.prototype.ignoreWhite = true;
var mndo:XML = new XML();
mndo.ignoreWhite = true;
mndo.onLoad = function(cargo) {
if (cargo) {

for ( i = 0; i < 100; i++) {
titles[i] = mndo.firstChild.childNodes[i].firstChild.nodeValue;
}

} else {
problema_txt.text = "Error";
}
};
mndo.load("fotos.xml");

Paz y flash
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:16.