Problema con onRelease establecido en dynamicly creado nmr

  • posidan
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 25, 2004
  • Mensajes: 11
  • Status: Offline

Nota Octubre 25th, 2004, 8:44 pm

Hola!
Ok, im tratando de hacer una galería de fotos aquí, carga dinámica de un XML. La parte XML es perfecto estado de funcionamiento, puedo crear mi clips de película sin ningún problema tampoco, y colocarlos donde yo quiera. la cosa ahora es que incluso si intenta agregar un evento en cada onRelease I MC crear dinámicamente, no parece funcionar. Im seguro de su algo más sencillo que yo no entiendo, pero soy atrapado aquí, y el proyecto se debe, en una semana (con todavía muchas cosas para completar...)

Así que cualquier ayuda sería más que apreciada.

Heres el bucle donde puedo crear mi mcs y añadirlos a mi mc contenedor miniatura:

Código: [ Select ]
for (i=0; i<_root.pix_number; i++) {
 // if theres more than 10 pictures, we add another film overlay
 if (count > 20) {            
  _root.film.thumbs.attachMovie("film_overlay","overlay"+i,i);
  new_film = _root.film.thumbs["overlay"+i];
  new_film._x = -1847;
  count = 1;
 }
                
 var mc = film.thumbs.pix_container.createEmptyMovieClip("mc" + i, i);
 // Position the new mc
 mc._x = 705 - (i*70 + (6.8*(i+1)));
 mc._y = 15;

 // Adds a event listener to the thumbnail so that when its clicked
 // it loads a picture in the photobucket
 mc.onRelease = function () {
  trace("mc clicked");
  // load photo in photobucket
 }
                
 var url = "images/" + pixArray[i].thumbnail;
 myLoader.load(mc, url);
 count++;
}
  1. for (i=0; i<_root.pix_number; i++) {
  2.  // if theres more than 10 pictures, we add another film overlay
  3.  if (count > 20) {            
  4.   _root.film.thumbs.attachMovie("film_overlay","overlay"+i,i);
  5.   new_film = _root.film.thumbs["overlay"+i];
  6.   new_film._x = -1847;
  7.   count = 1;
  8.  }
  9.                 
  10.  var mc = film.thumbs.pix_container.createEmptyMovieClip("mc" + i, i);
  11.  // Position the new mc
  12.  mc._x = 705 - (i*70 + (6.8*(i+1)));
  13.  mc._y = 15;
  14.  // Adds a event listener to the thumbnail so that when its clicked
  15.  // it loads a picture in the photobucket
  16.  mc.onRelease = function () {
  17.   trace("mc clicked");
  18.   // load photo in photobucket
  19.  }
  20.                 
  21.  var url = "images/" + pixArray[i].thumbnail;
  22.  myLoader.load(mc, url);
  23.  count++;
  24. }


myLoader es un objeto qlod.loaderClass aquí. Simplemente no puedo hacer clic en las fotos para que sean una carga más grande en el marco de i tienen.

Cualquier ayuda sería muy apreciada...GRACIAS
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Octubre 25th, 2004, 8:44 pm

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Registrado: Feb 10, 2004
  • Mensajes: 13455
  • Loc: Florida
  • Status: Offline

Nota Octubre 26th, 2004, 5:34 am

El cargador es reajustar sus eventos en que clip cuando está cargado.

Crear un espacio en blanco dentro de MC var = mc film.thumbs.pix_container.createEmptyMovieClip ( "mc" + i, i); Y el nombre "cargador". A continuación, asignar a onRelease "mc" y carga la imagen en miniatura en "cargador"
Strong with this one, the sudo is.
  • posidan
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 25, 2004
  • Mensajes: 11
  • Status: Offline

Nota Octubre 26th, 2004, 8:19 am

ok, sólo para estar seguro de que entiendo lo que quieres decir, debo hacer algo como:

var = mc film.thumbs.pix_container.createEmptyMovieClip ( "mc" + i, i);
mc.createEmptyMovieClip ( "cargador", i);

mc.onRelease = function () (
/ / Code
)

myLoader.load (mc.loader, url);


¿Es eso? no puedo probarlo ahora mismo, pero los malos intentarlo esta noche, y los malos volver con los resultados
¡Muchas gracias!
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Registrado: Feb 10, 2004
  • Mensajes: 13455
  • Loc: Florida
  • Status: Offline

Nota Octubre 26th, 2004, 10:52 am

Bastante.
Código: [ Select ]
mc.createEmptyMovieClip("loader", i);

"Cargador" se puede crear un 0 (cero) de profundidad, cada vez, ya que será la única cosa dentro de "MC" :wink:
Strong with this one, the sudo is.
  • posidan
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 25, 2004
  • Mensajes: 11
  • Status: Offline

Nota Octubre 26th, 2004, 8:35 pm

woohoo!

funciona perfectamente.

No puedo agradecerle lo suficiente, usted me de problemas aquí.

gracias de nuevo!
  • posidan
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 25, 2004
  • Mensajes: 11
  • Status: Offline

Nota Octubre 26th, 2004, 8:58 pm

Mmmm todavía tengo un problema con mi onRelease.

Ahora puedo cogerlo, pero cuando intento cargar la foto de la versión grande cuando se hace clic en el pulgar, siempre tengo la última carga...Mi código es similar que en la actualidad:

Código: [ Select ]
            for (i=0; i<_root.pix_number; i++) {
                // if theres more than 10 pictures, we add another film overlay
                if (count > 20) {
                    _root.film.thumbs.attachMovie("film_overlay","overlay"+i,i);
                    new_film = _root.film.thumbs["overlay"+i];
                    new_film._x = -1847;
                    count = 1;
                }
                
                var mc = film.thumbs.pix_container.createEmptyMovieClip("mc" + i, i);
                mc.createEmptyMovieClip("thumb", 0);
                // Position the new mc
                mc._x = 705 - (i*70 + (6.8*(i+1)));
                mc._y = 15;
                mc.picture = pixArray[i];

                // Adds a event listener to the thumbnail so that when its clicked
                // it loads a picture in the photobucket
                mc.onRelease = function () {
                    _root.scene_mc.large_pic_mc.loadMovie("file://d:/Programmation/RogerioBarbosa/site/images/" + mc.picture.filename);
                }
                
                var url = "images/" + pixArray[i].thumbnail;
                myLoader.load(mc.thumb, url);
                count++;
            }
  1.             for (i=0; i<_root.pix_number; i++) {
  2.                 // if theres more than 10 pictures, we add another film overlay
  3.                 if (count > 20) {
  4.                     _root.film.thumbs.attachMovie("film_overlay","overlay"+i,i);
  5.                     new_film = _root.film.thumbs["overlay"+i];
  6.                     new_film._x = -1847;
  7.                     count = 1;
  8.                 }
  9.                 
  10.                 var mc = film.thumbs.pix_container.createEmptyMovieClip("mc" + i, i);
  11.                 mc.createEmptyMovieClip("thumb", 0);
  12.                 // Position the new mc
  13.                 mc._x = 705 - (i*70 + (6.8*(i+1)));
  14.                 mc._y = 15;
  15.                 mc.picture = pixArray[i];
  16.                 // Adds a event listener to the thumbnail so that when its clicked
  17.                 // it loads a picture in the photobucket
  18.                 mc.onRelease = function () {
  19.                     _root.scene_mc.large_pic_mc.loadMovie("file://d:/Programmation/RogerioBarbosa/site/images/" + mc.picture.filename);
  20.                 }
  21.                 
  22.                 var url = "images/" + pixArray[i].thumbnail;
  23.                 myLoader.load(mc.thumb, url);
  24.                 count++;
  25.             }



Tenga en cuenta que pixArray es una matriz que contiene los objetos de imagen, que se define en otras partes del código, pero que sólo contiene un nombre de archivo en miniatura, un nombre de archivo, un nombre, una descripción y algunas otras propiedades.

Parece que no puedo Para que se cargue la buena imagen...se carga bien, pero con la misma imagen en cada pulgar.

Gracias por ayudar a un noob. ;)
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Registrado: Feb 10, 2004
  • Mensajes: 13455
  • Loc: Florida
  • Status: Offline

Nota Octubre 27th, 2004, 7:28 am

Esto debe mantener la última imagen que se utilice cada vez,
Código: [ Select ]
film.thumbs.pix_container["mc"+i].picture = pixArray[i];
film.thumbs.pix_container["mc"+i].onRelease = function () {
        _root.scene_mc.large_pic_mc.loadMovie("file://d:/Programmation/RogerioBarbosa/site/images/" + this.picture.filename);
      }
  1. film.thumbs.pix_container["mc"+i].picture = pixArray[i];
  2. film.thumbs.pix_container["mc"+i].onRelease = function () {
  3.         _root.scene_mc.large_pic_mc.loadMovie("file://d:/Programmation/RogerioBarbosa/site/images/" + this.picture.filename);
  4.       }

Que está reemplazando,
Código: [ Select ]
mc.picture = pixArray[i];

      // Adds a event listener to the thumbnail so that when its clicked
      // it loads a picture in the photobucket
      mc.onRelease = function () {
        _root.scene_mc.large_pic_mc.loadMovie("file://d:/Programmation/RogerioBarbosa/site/images/" + mc.picture.filename);
      }
  1. mc.picture = pixArray[i];
  2.       // Adds a event listener to the thumbnail so that when its clicked
  3.       // it loads a picture in the photobucket
  4.       mc.onRelease = function () {
  5.         _root.scene_mc.large_pic_mc.loadMovie("file://d:/Programmation/RogerioBarbosa/site/images/" + mc.picture.filename);
  6.       }
Strong with this one, the sudo is.
  • posidan
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Oct 25, 2004
  • Mensajes: 11
  • Status: Offline

Nota Octubre 27th, 2004, 7:04 pm

woohoo!

ok, de todos bordo, este es el mejor. Rápido y eficaz respuesta, muchas gracias.

ID gustaría saber aunque...en su primera respuesta, usted ha dicho que la carga de acción resetted el evento onRelease cada vez.....

ser un programador, veo MCs como objetos, que son, pero si identificador de hacer un bucle que se da en decir, java, id crear objetos y sus atributos nunca se resetted...¿hay un concepto no he recibido aquí, mejorar el aprendizaje rápido, pero id al igual que para comprender por qué me dieron estos errores (me refiero, lo que las causa, ¿cuál es la acción pila cuando hago un bucle, como lo hice...)

si tiene tiempo, claro.
gracias
  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Registrado: Feb 10, 2004
  • Mensajes: 13455
  • Loc: Florida
  • Status: Offline

Nota Octubre 27th, 2004, 9:51 pm

¿No está seguro de Macromedia por qué decidió hacerlo de esta manera pero supongo theyre pensar en ello como,
El objeto / mc es un contenedor, si es somthing de ser cargadas en este recipiente entonces las acciones previstas para antes de que el contenedor no puede ser necesaria o puede causar errores de los contenedores nuevos contenidos. Mejor reset thoose acciones a null como para evitar cualquier error.

Ahora, si usted loadMovie y configuración de su cargador para asignar el caso handelers una vez que su contenido se ha cargado entonces no hay necesidad de un sub-MC para cargar contenido en. Uso de 3 ª parte del cargador de clases tienden a nix que a pesar de capacidad :( Me parece más fácil de cargar las cosas sólo en sub-cc y saltar tratando de syncronize todo.
Strong with this one, the sudo is.

Publicar Información

  • Total de mensajes en este tema: 9 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 35 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC