Comunidad de diseño web y desarrollo en internet online

AutoPlay Galeria XML

Citar            
MensajeEscrito el 17 Sep 2009 02:46 am
Saludos Comunidad Clab!!

Estoy Trabajando en una Galeria de Fotos XML la que carga un numero x de fotos con su respectivo comentario y funciona con un par de botones Prev y Next...

Mi consulta es la siguiente:
Puedo hacer que al ejecutal el swf, la transicion de las imagenes se ejecule automaticamente sin necesidad de presionar el boton next?? pero que este igual funcione??

hasta donde se, creo q se puede hacer con un set interval... o algo asi, poniendo un tiempo de intervalo determinado (el que idealmente seria de unos 10 seg, pero que se pueda acortar presionando el boton next)

lo otro, puedo cambiar la forma de transicion de las fotos, la que es con un fade, pero me gustaria que fuese algo asi como un slide... que las fotos entaran de derecha a izquierda desplazando obviamente la que se esta mostrando, hacia la izquierda...

Aca el codigo que uso en la galeria...

Código :

function loadPhotoXml(filename)
{
    PhotoXml.load(filename);
    PhotoXml.onLoad = function (success)
    {
        if (success)
        {
            My_SlideNumber = 0;
            My_ParentNode = this.firstChild;
            My_TotalSlides = My_ParentNode.childNodes.length;
            showPhoto(My_SlideNumber);
        } // end if
    };
} // End of the function
function showPhoto(PhotoNum)
{
    if (PhotoNum == My_TotalSlides - 1)
    {
        Next_btn.enabled = false;
    }
    else
    {
        Next_btn.enabled = true;
    } // end else if
    if (PhotoNum == 0)
    {
        Previous_btn.enabled = false;
    }
    else
    {
        Previous_btn.enabled = true;
    } // end else if
    var _loc3 = My_ParentNode.childNodes[PhotoNum].attributes.filename;
    var _loc4 = My_ParentNode.childNodes[PhotoNum].attributes.heading;
   var _loc5 = My_ParentNode.childNodes[PhotoNum].attributes.nombre;
    empty_mc.loadMovie("photos/" + _loc3);
    caption_text.text = _loc4;
   name_text.text = _loc5;
    empty_mc._alpha = 0;
    this.onEnterFrame = function ()
    {
        if (empty_mc._alpha < 100)
        {
            empty_mc._alpha = empty_mc._alpha + 3;
        } // end if
    };
} // End of the function
var My_SlideNumber;
var My_TotalSlides;
var My_ParentNode;
var PhotoXml = new XML();
PhotoXml.ignoreWhite = true;
loadPhotoXml("photos.xml");



Thanks again!!

Por zorpresa

35 de clabLevel



Genero:Masculino  

Director de Arte

safari
Citar            
MensajeEscrito el 17 Sep 2009 11:32 am
Puedes agregar una función como esta:

Código ActionScript :

function siguiente(){
  showPhoto(++PhotoNum)
}


Y luego la llamas con un setInterval

t = setInterval(siguiente, 10000)

Jorge

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 17 Sep 2009 01:30 pm
Gracias Jorge, pero al colocar los codigos que me diste me arroja un error luego de los diez segundos, me dice que no encuentra la imagen siguiente: Error opening Url... y el texto de la imagen dice Undefined.

quizas puse mal los codigos q me entregaste?? O sera de problema de la funcion??

Código :

function loadPhotoXml(filename)
{
    PhotoXml.load(filename);
    PhotoXml.onLoad = function (success)
    {
        if (success)
        {
            My_SlideNumber = 0;
            My_ParentNode = this.firstChild;
            My_TotalSlides = My_ParentNode.childNodes.length;
            showPhoto(My_SlideNumber);
        } // end if
    };
} // End of the function
function showPhoto(PhotoNum)
{
    if (PhotoNum == My_TotalSlides - 1)
    {
        Next_btn.enabled = false;
    }
    else
    {
        Next_btn.enabled = true;
    } // end else if
    if (PhotoNum == 0)
    {
        Previous_btn.enabled = false;
    }
    else
    {
        Previous_btn.enabled = true;
    } // end else if
    var _loc3 = My_ParentNode.childNodes[PhotoNum].attributes.filename;
    var _loc4 = My_ParentNode.childNodes[PhotoNum].attributes.heading;
   var _loc5 = My_ParentNode.childNodes[PhotoNum].attributes.nombre;
    empty_mc.loadMovie("photos/" + _loc3);
    caption_text.text = _loc4;
   name_text.text = _loc5;
    empty_mc._alpha = 0;
    this.onEnterFrame = function ()
    {
        if (empty_mc._alpha < 100)
        {
            empty_mc._alpha = empty_mc._alpha + 3;
        } // end if
    };
} // End of the function
function siguiente(){ 
  showPhoto(++PhotoNum) 
}

var My_SlideNumber;
var My_TotalSlides;
var My_ParentNode;
var PhotoXml = new XML();
PhotoXml.ignoreWhite = true;
loadPhotoXml("photos.xml");
t = setInterval(siguiente, 10000)

Por zorpresa

35 de clabLevel



Genero:Masculino  

Director de Arte

safari
Citar            
MensajeEscrito el 17 Sep 2009 01:38 pm
Bueno, dos cosas. Debes lanzar el intervalo luego de haber terminado de cargar el XML, y hay que inicializar PhotoNum, entonces agrega al principio:

var PhotoNum = 0

Y mueve el setInterval en PhotoXml.onLoad debajo de esta línea

showPhoto(My_SlideNumber);
t = setInterval(siguiente, 10000)

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 17 Sep 2009 02:04 pm
Muchisimas Gracias Jorge!! funciona todo a la perfeccion!!!

otra consulta quizas puedas ayudarme...

Quiero poner un link a uno de los textos dinamicos que carga el flash desde el xml

creo q se hace en el xml, pero he buscado algunos codigos y no funcionan

Código :

<?xml version="1.0" standalone="yes" ?>
<PhotoGallery>

   <image  filename="01.jpg" heading="6.50 mts
3.50 mts
De 1.00 mts a 1.50 mts
18.000 lts" 
nombre="Hawai super"
/>
</PhotoGallery>   



donde dice nombre= me gustaria que el nombre linkeara con una pagina

Gracias nuenvamente

Por zorpresa

35 de clabLevel



Genero:Masculino  

Director de Arte

safari
Citar            
MensajeEscrito el 17 Sep 2009 02:07 pm
No puedes poner un link directamente (href) porque da error a menos que uses nodo CDATA. Puedes agregar una nueva propiedad (digamos attributes.link) y luego cambiar el caption_text a htmlText, combinando la nueva propiedad para armar el href

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 17 Sep 2009 03:12 pm
Ohh denuevo muchas gracias!!

Estimado, Finalmente otra consulta con el flash...

como puedo hacer para que cuando llege a la ultima foto (ya sea por intervalo o por los botones) en este caso son 6 fotos

vuelva nuevamente a la primera, por que se queda pegada en la ultima...

Por zorpresa

35 de clabLevel



Genero:Masculino  

Director de Arte

safari
Citar            
MensajeEscrito el 17 Sep 2009 03:15 pm
ohh me acabo de dar cuenta de que no se queda pegada en la ultima foto... me arroja un undefined!!!

Por zorpresa

35 de clabLevel



Genero:Masculino  

Director de Arte

safari
Citar            
MensajeEscrito el 17 Sep 2009 03:41 pm
Para evitar que se siga incrementando sin fin tienes que limitarla, así por ejemplo un loop

Código ActionScript :

function siguiente(){ 
  PhotoNum++
  if (PhotoNum == My_TotalSlides ) PhotoNum = 0 
  showPhoto(PhotoNum) 
}


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 08 Dic 2010 04:08 am
Saludos master, tengo el mismo problema, necesito hacer un autoplay, pero no se como ??
alguien me podria ayudar?..adjunto codigo



function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
thumb = [];
image = [];
caption_txt = [];
full_txt = [];
url = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
thumb[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
image[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
caption_txt[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
full_txt[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
url[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
gotoAndStop(2);
}
} else {
trace("Error loading XML");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("inicio.xml");
stop();


de antemano gracias

Por Unsilent

2 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Dic 2010 10:05 am
Abre un POST nuevo y pon código relevante ... la rutina de parseo del XML no ayuda mucho a ver como tienes tu mecanismo de play.

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 08 Dic 2010 11:19 pm

solisarg escribió:

Abre un POST nuevo y pon código relevante ... la rutina de parseo del XML no ayuda mucho a ver como tienes tu mecanismo de play.

Jorge


Saludos Jorge y gracias por responder... post creado:

http://foros.cristalab.com/ayuda-con-autoplay-xml-t93363/#581379

Por Unsilent

2 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.