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

Ayuda con Slideshow

Estas en el tema de Ayuda con Slideshow en el foro de Flash y Actionscript en Foros del Web. Hola amigos, tengo un slideshow que toma datos de un xml... en el archivo de flash esta el siguiente script para el xml @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); ...
  #1 (permalink)  
Antiguo 25/02/2010, 16:13
 
Fecha de Ingreso: octubre-2009
Mensajes: 10
Antigüedad: 14 años, 5 meses
Puntos: 0
Ayuda con Slideshow

Hola amigos, tengo un slideshow que toma datos de un xml... en el archivo de flash esta el siguiente script para el xml

Código actiosncript:
Ver original
  1. function loadXML(success) {
  2.     if (success) {
  3.         xmlNode = this.firstChild;
  4.         description_x = [];
  5.         description_y = [];
  6.         description_w = [];
  7.         picture_path = [];
  8.         description = [];
  9.         web_address = [];
  10.  
  11.         total = xmlNode.childNodes.length;
  12.         for (i=0; i<total; i++) {
  13.             description_x[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
  14.             description_y[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
  15.             description_w[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
  16.             picture_path[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
  17.             description[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
  18.             web_address[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
  19.  
  20.         }
  21.         delay_time = Number(this.firstChild.attributes.delay_time*1000);
  22.         bgColor = this.firstChild.attributes.bgColor;
  23.         BGcolor = new Color(background_mc);
  24.         BGcolor.setRGB(bgColor);
  25.         preloaderColor = this.firstChild.attributes.preloaderColor;
  26.         PRLcolor = new Color(preloader);
  27.         PRLcolor.setRGB(preloaderColor);
  28.         holder_mc._x = 0;
  29.         holder_mc._y = 0;
  30.         menu_visible = this.firstChild.attributes.menu_visible;
  31.         if (menu_visible == "no" || menu_visible == "NO") {
  32.             slideMenu._visible = false;
  33.         } else {
  34.             slideMenu._visible = true;
  35.         }
  36.         menu_axis = this.firstChild.attributes.menu_axis;
  37.         menu_x = Number(this.firstChild.attributes.menu_x);
  38.         menu_y = Number(this.firstChild.attributes.menu_y);
  39.         bannerBTN=this.firstChild.attributes.bannerBTN;
  40.         if (bannerBTN == "no" || bannerBTN == "NO") {
  41.             holder_mc.btn._visible = false;
  42.         } else {
  43.             holder_mc.btn._visible = true;
  44.         }
  45.         menu_spacer = Number(this.firstChild.attributes.menu_spacer);
  46.         slideMenu._x = menu_x;
  47.         slideMenu._y = menu_y;
  48.         menu();
  49.         slide();
  50.     } else {
  51.         holder_mc.description_txt.text = "Cargando... ";
  52.     }
  53.     delete xmlData;
  54. }
  55. start_x = 0;
  56. start_y = 0;
  57. function slide() {
  58.     if (n == undefined || n == total) {
  59.         n = 0;
  60.     }
  61.     clearInterval(timeInterval);
  62.     menuColor(n);
  63.     buildSlideshow(n);
  64.     ++n;
  65. }
  66.  
  67.  
  68. function menu() {
  69.     for (i=0; i<total; i++) {
  70.         slideMenu.attachMovie("menu_btn", "item"+i, i);
  71.         item = slideMenu["item"+i];
  72.         item.number_box.text = i+1;
  73.         if (menu_axis == "x" || menu_axis == "X") {
  74.             item._x = start_x;
  75.         }
  76.         if (menu_axis == "y" || menu_axis == "Y") {
  77.             item._y = start_y;
  78.         }
  79.         start_x += menu_spacer+item._width;
  80.         start_y += menu_spacer+item._height;
  81.         item.num = i;
  82.         item.onRelease = function() {
  83.             clearInterval(timeInterval);
  84.             slide(n=this.num);
  85.         };
  86.     }
  87. }
  88. function buildSlideshow(i) {
  89.     holder_mc._alpha = 0;
  90.     holder_mc.description_txt._x = description_x[i];
  91.     holder_mc.description_txt._y = description_y[i];
  92.     holder_mc.description_txt._width = description_w[i];
  93.     holder_mc.picture_mc.loadMovie(picture_path[i]);
  94.     holder_mc.description_txt.autoSize = "left";
  95.     holder_mc.description_txt.htmlText = description[i];
  96.     holder_mc.btn._width = 475;
  97.     holder_mc.btn._height = 260;
  98.     holder_mc.btn.onRelease = function() {
  99.         getURL(web_address[i], "_self");
  100.     };
  101.    
  102.    
  103.    
  104.    
  105.    
  106.    
  107.    
  108.    
  109.     this.onEnterFrame = function() {
  110.         preloader._alpha = 100;
  111.         bLoaded = holder_mc.picture_mc.getBytesLoaded();
  112.         bTotal = holder_mc.picture_mc.getBytesTotal();
  113.         if (bLoaded<bTotal) {
  114.             holder_mc._alpha = 0;
  115.             preloader.loader_txt.htmlText = "Cargando "+ Math.round(bLoaded/bTotal*100)+"%";
  116.         } else if (bLoaded>=bTotal && bLoaded>100 && bTotal>100) {
  117.             preloader._alpha = 0;
  118.             if (holder_mc._alpha<100) {
  119.                 preloader.loader_txt.htmlText = "";
  120.                 holder_mc._alpha += 10;
  121.             }
  122.             if (holder_mc._alpha>=100) {
  123.                 timeInterval = setInterval(slide, delay_time);
  124.                 delete this.onEnterFrame;
  125.             }
  126.         }
  127.     };
  128.     if (holder_mc.description_txt.text == "" or holder_mc.description_txt.text == " ") {
  129.         holder_mc.back_color._alpha = 0;
  130.     } else {
  131.         holder_mc.back_color._alpha = 100;
  132.     }
  133.     holder_mc.back_color._x = holder_mc.description_txt._x;
  134.     holder_mc.back_color._y = holder_mc.description_txt._y;
  135.     holder_mc.back_color._width = holder_mc.description_txt._width;
  136.     holder_mc.back_color._height = holder_mc.description_txt._height;
  137. }
  138. function menuColor(n) {
  139.     for (i=0; i<total; i++) {
  140.         slideMenu["item"+i].gotoAndStop(1);
  141.     }
  142.     slideMenu["item"+n].gotoAndPlay("s1");
  143. }
  144. this.createEmptyMovieClip("slideMenu", this.getNextHighestDepth());
  145. xmlData = new XML();
  146. xmlData.ignoreWhite = true;
  147. xmlData.onLoad = loadXML;
  148. xmlData.load("slideshow.xml");


el problema es que carga en forma lineal y no hay manera de hacerlo aleatoriamente.....


será que me pueden colaborar?


gracias

Última edición por kadhessim; 25/02/2010 a las 16:28

Etiquetas: actionscript, slideshow, xml
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 10:00.