Comunidad de diseño web y desarrollo en internet online

dudas sobre tutorial de slideshow

Citar            
MensajeEscrito el 14 Ene 2010 01:34 am
Hola, a todos!

He revisado e implementado la siguiente forma de hacer slideshow de este link

http://www.cristalab.com/tutoriales/crear-presentaciones-en-flash-con-custom-slideshows-c247l/

Aparte agregue otro archivo a manera de player que sea el que recoge la informacion del archivo.xml

el codigo que uso es el siguiente

Código :

stop();
System.security.allowDomain("localhost");
var captions=false;
var transition_time=0;
desc_txt._visible=false;
pos_txt._visible=false;
controls.pause_btn._visible=false;
var is_paused=false;
var audio_paused=false;
var timer_interval;
ErrorMessage._visible=false;
error_counter=0;
folder_path = _level0.slideshow+'/';
trace(_level0.slideshow);
if(_level0.slideshow==undefined) folder_path='';


attachMovie("FLVPlayback", "videoPlayer", 10, {width:320, height:240, x:90, y:100});
audioPlayer = new Sound (soundLoader);



function loadXML(loaded) {

if (loaded) {

xmlNode = this.firstChild;
image = [];
description = [];
media_type = [];
total = xmlNode.childNodes.length;
if(xmlNode.attributes.captions=="on"){
   _root.captions=true;
   desc_txt._visible=true;
}
if(xmlNode.attributes.numbering=="on"){
   _root.numbering=true;
   pos_txt._visible=true;
}
if(xmlNode.attributes.transition_time>0){
   _root.transition_time=xmlNode.attributes.transition_time;
   _root.soundtrack=_root.folder_path+xmlNode.attributes.mp3;
   if(_root.soundtrack!=undefined) audioPlayer.loadSound(_root.soundtrack, true);
   controls.pause_btn._visible=true;
   //trace(xmlNode.attributes.transition_time);
   clearInterval(_level0.timer_interval);
   _level0.timer_interval = setInterval(nextImage,(_root.transition_time*1000));
   
//clearInterval(myInterval);
}
for (i=0; i<total; i++) {

   image[i] = _root.folder_path+xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
   description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
   
   if(xmlNode.childNodes[i].attributes.mediatype=="image")
      media_type[i]="image";
   else
      media_type[i]="flv";
}
firstImage();

} else {

content = "file not loaded!";

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(folder_path+"images.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {

if (Key.getCode() == Key.LEFT) {

prevImage();

} else if (Key.getCode() == Key.RIGHT) {

nextImage();

}

};
Key.addListener(listen);
controls.prev_btn.onRelease = function() {
   prevImage();
};
controls.pause_btn.onRelease = function() {
   onPausePlay();
};
controls.next_btn.onRelease = function() {
   nextImage();
};
/////////////////////////////////////
p = 0;
this.onEnterFrame = function() {

   filesize = picture.getBytesTotal();
   loaded = picture.getBytesLoaded();
   if(filesize==-1) {
      error_counter++;
      if(error_counter>10){
      ErrorMessage.text="Error: Media file not found.  Check images.xml";
      ErrorMessage._visible=true;
      }
   }else{
      ErrorMessage._visible=false;
      error_counter=0;
   }
   preloader._visible = true;
   if (loaded != filesize) {
      preloader.preload_bar._xscale = 100*loaded/filesize;
   } else {
      
      
      preloader._visible = false;
      if (picture._alpha<100) {
         picture._alpha +=5;
      }

   }

};
function nextImage() {
   if (p<(total-1)) {
      p++;
      switchImage();
      
   }
}
function prevImage() {

   if (p>0) {
      p--;
      switchImage();
   }

}
function switchImage(){
   clearInterval(_level0.timer_interval);
   //trace("switching to image "+image[p]);
   if(media_type[p]=="image"){
         if(audio_paused){
            audioPlayer.start(pause_resume / 1000);
            audio_paused=false;
         }
         
         if(videoPlayer.state=="playing") videoPlayer.stop();
         if (loaded == filesize) {
            picture._visible=true;
            videoPlayer._visible=false;
            //videoPlayer.stop();
            picture._alpha = 0;
            picture.loadMovie(image[p], 1);
            set_caption(description[p]);
            picture_num();
         }
         if((_root.transition_time>0)&& (media_type[p]=="image")){
            clearInterval(_level0.timer_interval);
            _level0.timer_interval = setInterval(nextImage,(_root.transition_time*1000));
         }
      }else{
         clearInterval(_level0.timer_interval);
         _root.pause_resume = audioPlayer.position;
         _root.audio_paused=true;
           audioPlayer.stop();
         picture._visible=false;
         videoPlayer._visible=true;
         var listenerObject:Object = new Object();
         listenerObject.resize = function(eventObject:Object):Void {
            //center video in playback area
            newx = (Stage.width - videoPlayer.preferredWidth)/2;
            newy = (Stage.height - videoPlayer.preferredHeight)/2;
            
            videoPlayer._x = newx;
            videoPlayer._y = newy;
         };
         videoPlayer.addEventListener("resize", listenerObject);    
         listenerObject.ready = function(eventObject:Object):Void {
              videoPlayer.setSize(250, 350);
         };

         videoPlayer.skin = "ClearExternalPlaySeekMute.swf";
         videoPlayer.clear();
         videoPlayer.contentPath = image[p];
         videoPlayer.autoSize = true;
         videoPlayer.play();
         var flvlistenerObject:Object = new Object();
flvlistenerObject.stopped = function(eventObject:Object):Void {
nextImage();
};
videoPlayer.addEventListener("stopped", flvlistenerObject);
         //ns.play(image[p]);
      }
}
function firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
set_caption(description[p]);
picture_num();
   

}

}
function picture_num() {

current_pos = p+1;
if(_root.numbering==true){
   pos_txt.text = current_pos+" / "+total;
}


}
function onPausePlay(){
   if(_root.is_paused==true){
      if(_root.transition_time>0){
         clearInterval(_level0.timer_interval);
         _level0.timer_interval = setInterval(nextImage,(_root.transition_time*1000));
         _root.is_paused=false;
         _root.pause_btn.pause_txt.text="Pause";
      }
   }else{
      clearInterval(_level0.timer_interval);
      pause_btn.pause_txt.text="Play";
      _root.is_paused=true;
      
   }
}
function set_caption(caption){
   
   if((_root.captions==true) &&(caption!=undefined)){
   desc_txt.text = caption;
   desc_txt._visible=true;
}else{
   desc_txt._visible=false;
}

}


y me hecha a perder el tiempo de duracion de cada foto y el efecto de transicion entre cada foto.
haciendolo algunas veces mas rapido otras veces mas lenta. y en fin no se ve fluido.

alguien me podria ayudar con esto.

gracias

Por chicolocopro

10 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 14 Ene 2010 03:09 am
1. ¿Ayudarte con que?
2. Postea solo el problema no todo el código. Yo personalmente no leere todo eso.

Saludos, Hernán . -

Por Hernán

BOFH

6148 de clabLevel

19 tutoriales
23 articulos

Genero:Masculino   REC Desarrollador de GAIA

Marketing & IT

firefox
Citar            
MensajeEscrito el 14 Ene 2010 03:22 am
Hola again,

Este es el codigo que utilizo en un archivo que funciona a manera de player, el va y busca en una carpeta especifica las fotos, videos, audios, y los carga. Pero me desfasa los tiempos de duracion de cada foto y el efecto de fade in/out, no lo hace correctamente.

No se si seguir utilizando este embrollo de codigo, o algo tengo mal que no hace que las fotos al pasar a la siguiente haga el efecto.

Desearia aprender hacer un slideshow mas eficiente que me sea practico actualizar, incorporando nuevas fotos, videos y audios, sin que el tiempo de duracion de cada foto y del efecto se vean desfavorecidos.

Por chicolocopro

10 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 05 Ago 2010 11:10 pm
Cordial saludo, yo también estoy buscando algo similar. una galería de imágenes sincronizada con la música. y ojala con barra de progreso/ubicacion. Con la posibilidad de comprárselo. vivo en Bogota Colombia. gracias de antemano

Por rowilson

8 de clabLevel



 

firefox
Citar            
MensajeEscrito el 05 Ago 2010 11:11 pm
Cordial saludo, yo también estoy buscando algo similar. una galería de imágenes sincronizada con la música. y ojala con barra de progreso/ubicacion. Con la posibilidad de comprárselo. vivo en Bogota Colombia. gracias de antemano

Por rowilson

8 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Ago 2010 12:40 am
Hola Rowilson,

Revisa aldochaparro.com
a ver si es lo que andas buscando.

Yo al final pude hacer que el fade no se desfasara. Actualizado mi precarga.

Saludos

Por chicolocopro

10 de clabLevel



Genero:Masculino  

firefox

 

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