Comunidad de diseño web y desarrollo en internet online

código de archivo swf externo

Citar            
MensajeEscrito el 12 Ene 2009 12:23 pm
Buenas.
Tengo un problema pq tengo una galería de imagenes configurada y funciona a la perfección al abrirla por si sola, el problema es cuando la cargo a una pelicula principal como archivo externo swf ya que tiene codigo que hace referencia a _root y ese código por lo que aprecio es como si hiciera referencia a la pelicula principal en lugar de a la galería. por que codigo puedo cambiar el _root para que en lugar de hacer referencia a la pelicula principal, haga referencia a la linea de tiempo principal de la galería. espero haber sido claro, si necesitan que les cuente algo mas preguntenlo.
gracias de antemano.

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 12 Ene 2009 12:51 pm
Bueno como pienso que será mucho más facil si veis el ejemplo concreto os subo los archivos, además no tiene desperdicio pq es sin duda la mejor galería de fotos que he encontrado, y puedo decir que he buscado mucho, además ya me la he currado tela para conseguir comprimirla y está bastante clara ya, si que es verdad que es un poco complicada, por lo menos para mi lo ha sido :p.

Gracias y por favor ayudenme!!!

http://www.megaupload.com/es/?d=GT2I0C60

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 12 Ene 2009 08:55 pm
Pues lo que pasa es exactamente eso. Para evitarlo, la recomendación es no usar _root. En cualquier caso, como ya lo tienes hecho y tengo por política personal no descargar archivos que no estoy buscando, abre el fla de la galería y coloca en el primer fotograma:

Código ActionScript :

_lockroot = true;

Eso hará que "bloquee" el _root de la galería, haciendo que apunte a ella en vez de a la película principal.

Por cierto, tu avatar excede el tamaño máximo permitido (100x100). Redúcelo, por favor.

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 12 Ene 2009 09:12 pm
mil gracias por tu respuesta, lo pruebo en cuanto pueda y te comento.
perdona por lo del avatar, ha sido una intrusión de 50webs, q es donde tenía alojado el mio original.
ya lo cambio sorry, y de nuevo muchas gracias pq me has iluminado...

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 12 Ene 2009 09:27 pm
The Fricky! lo acabo de probar y no funciona, ahora no lee el archivo php para cargar los datos de la galería, es más complejo de lo que parece, no obstante te lo agradezco y seguiré probando, aun así ya aprendí algo nuevo...

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 12 Ene 2009 09:52 pm
Si te da mucha guerra, postea el código que usas para cargar los datos.

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 13 Ene 2009 04:04 pm
Flipante, ya tenía casi todo escrito, pero era tan largo y pesado que ha petado la página...

Bueno empiezo de nuevo aunque ahora algo más escueto que no tengo tiempo...
Voy a hacer un esquema del archivo con sus códigos.

Empezaré poniendo un esquema gráfico de la estructura del archivo principal.


La primer capa contiene el código en ActionScript.
La segunda capa llamado labels, contiene etiquetas de nombres de fotogramas.
La tercera capa contiene el MC del menu, llamado menu_mc.
La cuarta capa contiene el MC de la galeria de imagenes, llamado pages.

Código del primer fotograma (linea principal).

Código ActionScript :

Stage.align = "MC";
Stage.scaleMode = "noScale";
url = "xxxxx";
loadVariablesNum((url + "_main.php"), 0);
intervalID = setInterval(check_loaded, 100);
_root.link = 1;
_root.link_prev = 0;
_root.G = 1;
stage_bg_animation.stage_bg._x = -1200;
stage_bg_animation.stage_bg._y = -1019;


Código del fotograma 2 (linea principal).

Código ActionScript :

function more_click_func(num){
   if(_root.link != num && _root.G != 1){
      if(_root.link == 4){
         _root.menu_mc.gotoAndPlay("s2");
      }
      _root.G = 1;
      _root.link_prev = _root.link;
      _root.link = num;
      _root.cover01.gotoAndStop(2);
      _root.gotoAndPlay("s1");
   }
}


Código del fotograma 3 (linea principal).

Código ActionScript :

pages._visible = 0;


Código del fotograma 13 (linea principal).

Código ActionScript :

pages._visible = 1;


Código del fotograma 14 (linea principal).

Código ActionScript :

_root.G = 0;
stop();


Código del fotograma 16 (linea principal).

Código ActionScript :

pages.gotoAndStop(_root.link);
if(pages._currentframe == 4){
   pages.gallery.play();
}


Código del fotograma 17 (linea principal).

Código ActionScript :

pages._visible = 1;


Código del fotograma 18 (linea principal).

Código ActionScript :

_root.G = 0;
stop();


Código del botón dentro de MC menu_mc.

Código ActionScript :

on(rollOver){
   if(_root.link != page){
      gotoAndPlay("s1");
   }
}
on(releaseOutside, rollOut){
   if(_root.link != page){
      gotoAndPlay("s2");
   }
}
on(release){
   if(_root.link != page && _root.G != 1){
      if(_root.link == 4){
         _parent.gotoAndPlay("s2");
      }
      _parent.gotoAndPlay("s1");
      _root.G = 1;
      _parent[("item" + _root.link)].gotoAndPlay("s2");
      _root.link = page;
      _root.gotoAndPlay("s1");
   }
}


Código del archivo main.php.

Código :

//GALLERY

&stage_width=900&
&stage_height=600&

&gallery_width=500
&gallery_height=400


&preview_x_correction=1
&preview_y_correction=1
&preview_height_correction=-2
&preview_width_correction=-2


&zoom_x=20
&zoom_y=20


&menu_position=vertical&

&gallery_button__correction=0&
&page_back_correction=0;
&page_next_correction=0;


&comment_x_correction=0.0&
&comment_y_correction=3.0&

&comment_left=10
&comment_right=20

&menu_offset=-7.1&

&small_picture_x_correction=2&
&small_picture_y_correction=1&
&small_picture_height_correction=0&
&small_picture_width_correction=0&

&file_option=php&
&template_help_preview=false&


Código del archivo gallery.php.

Código :

&cat_0=TITULO 1 DEL MENU&

&cat_0_pic_0=pic00.jpg&
&cat_0_comment_0=COMENTARIO DE LA IMAGEN 1&


&cat_1=TITULO 2 DEL MENU&

&cat_1_pic_0=pic00.jpg&


&cat_2=TITULO 3 DEL MENU&

&cat_2_pic_0=pic00.jpg&


&cat_3=TITULO 4 DEL MENU&

&cat_3_pic_0=pic00.jpg&


&preview_position=left&
&preview_offset=14&

&image_width=61&
&image_height=61&

&h_space=14&
&v_space=14&

&colls=1&
&rows=1&

&listing_offset=8&

&open_in_browser=true&

&comment_position=stretched&


Estructura del MC pages.


En la capa Level1 capa se encuentra un MC llamado gallery(1)


Código del fotograma 1 (MC pages)

Código ActionScript :

stop();


Código del MC gallery(1).

Código ActionScript :

onClipEvent(load){
   function check_loaded(){
      if(_root.comment_position){
         _parent.gallery.gotoAndStop(2);
      }
   }
   if(!_root.comment_position){
      loadVariablesNum(((_root.url + "_gallery.") + _root.file_option), 0);
      _parent.gallery.stop();
      intervalID = setInterval(check_loaded, 100);
   }
}


Dentro del MC gallery encontramos la siguiente estructura.


En la capa Level 1 volvemos a encontrar un MC llamado nuevamente gallery(2).

Código del fotograma 1 y 2.

Código ActionScript :

stop();


Código del MC gallery(2).

Código ActionScript :

onClipEvent(load){
   gallery_width = parseInt(_root.gallery_width);
   gallery_height = parseInt(_root.gallery_height);
   maxWidth = parseInt(_root.image_width);
   maxHeight = parseInt(_root.image_height);
   h_space = parseInt(_root.h_space);
   v_space = parseInt(_root.v_space);
   rows = parseInt(_root.rows);
   colls = parseInt(_root.colls);
   listing_offset = parseInt(_root.listing_offset);
   listing_height = this.page_back_clip._height;
   if(this.page_next_clip._height > listing_height){
      listing_height = this.page_next_clip._height;
   }
   if(this.pages_listing._height > listing_height){
      listing_height = this.pages_listing._height;
   }
   if(_root.preview_position == "left" || _root.preview_position == "right"){
      y_offset = "false";
      x_offset = "true";
      x_position = _root.preview_position;
      big_image_x_offset = parseInt(_root.preview_offset);
      big_height = ((gallery_height - listing_height) - listing_offset) - big_image_x_offset;
      big_width = ((gallery_width - colls * ((maxWidth + h_space))) + h_space) - big_image_x_offset;
      rows = int(big_height / maxHeight);
      v_space = (big_height - maxHeight * rows) / (rows - 1);
   }
   if(_root.preview_position == "top" || _root.preview_position == "bottom"){
      y_offset = "true";
      x_offset = "false";
      y_position = _root.preview_position;
      big_image_y_offset = parseInt(_root.preview_offset);
      big_width = gallery_width;
      big_height = ((((gallery_height - rows * ((maxHeight + v_space))) + v_space) - big_image_y_offset) - listing_height) - listing_offset;
      colls = int(big_width / maxWidth);
      h_space = (big_width - maxWidth * colls) / (colls - 1);
      trace(h_space);
   }
   menu_position = _root.menu_position;
   menu_offset = parseFloat(_root.menu_offset);
   small_picture_bg_width_correction = parseInt(_root.small_picture_bg_width_correction);
   small_picture_bg_height_correction = parseInt(_root.small_picture_bg_height_correction);
   small_picture_pic_width_correction = parseInt(_root.small_picture_pic_width_correction);
   small_picture_pic_height_correction = parseInt(_root.small_picture_pic_height_correction);
}


Por último dentro del MC gallery(2), encontramos una serie de elementos, que no nos afectan, lo importante son los primeros 2 fotogramas, con el siguiente código.

Código del fotograma 1 (Linea principal>pages>gallery(1)>gallery(2).

Código ActionScript :

if(!img_start){
   img_start = 0;
}
var pic_names = new Array();
var category;
if(!_root.gallery_category){
   category = 0;
} else if(_root.gallery_category){
   category = _root.gallery_category;
}
listing_bg._visible = 0;
page_back_clip._visible = 0;
page_next_clip._visible = 0;
pages_listing._visible = 0;
preview._visible = 0;
big_image._visible = 0;
if(!_root.comment_position){
   cats_buttons._visible = 0;
}


Código del fotograma 2 (Linea principal>pages>gallery(1)>gallery(2).

Código ActionScript :

if(!category){
   category = 0;
}
if(colls == 0 || rows == 0){
   stop();
}
var coll_position = 0;
var row_position = 0;
i = img_start;
while(i < (img_start + colls * rows)){
   if(_root[((("cat_" + category) + "_pic_") + i)]){
      this[("image" + i)].removeMovieClip();
      duplicateMovieClip(preview.clip, [("image" + i)], i);
      preview.clip._visible = 0;
      preview[("image" + i)]._x = Math.round(((maxWidth + h_space)) * coll_position);
      preview[("image" + i)]._y = Math.round(((maxHeight + v_space)) * row_position);
      preview[("image" + i)].small_image_mask._width = maxWidth;
      preview[("image" + i)].small_image_mask._height = maxHeight;
      preview[("image" + i)].big_cont_bg._width = maxWidth;
      preview[("image" + i)].big_cont_bg._height = maxHeight;
      preview[("image" + i)].small_image_mask._x = parseFloat(_root.small_picture_x_correction);
      preview[("image" + i)].small_image_mask._y = parseFloat(_root.small_picture_y_correction);
      preview[("image" + i)].small_image_mask._width +=  parseFloat(_root.small_picture_width_correction);
      preview[("image" + i)].small_image_mask._height +=  parseFloat(_root.small_picture_height_correction);
      preview[("image" + i)].maxWidth = preview[("image" + i)].small_image_mask._width;
      preview[("image" + i)].maxHeight = preview[("image" + i)].small_image_mask._height;
      if(_root.template_help_preview != "true"){
         preview[("image" + i)].small_pic_to_load = (_root[("cat_" + category)] + "/small/") + _root[((("cat_" + category) + "_pic_") + i)];
         preview[("image" + i)].big_pic_to_load = (_root[("cat_" + category)] + "/big/") + _root[((("cat_" + category) + "_pic_") + i)];
      }
      if(_root.template_help_preview == "true"){
         preview[("image" + i)].small_pic_to_load = (((_root.url + "_") + _root[("cat_" + category)]) + "_small_") + _root[((("cat_" + category) + "_pic_") + i)];
         preview[("image" + i)].big_pic_to_load = (((_root.url + "_") + _root[("cat_" + category)]) + "_big_") + _root[((("cat_" + category) + "_pic_") + i)];
      }
      if(_root[((("cat_" + category) + "_comment_") + i)]){
         preview[("image" + i)].picture_comment = _root[((("cat_" + category) + "_comment_") + i)];
      }
      preview[("image" + i)].category = _root[("cat_" + category)];
      preview[("image" + i)].gotoAndPlay(2);
      preview[("image" + i)].p1.small_picture_bg_width_correction = small_picture_bg_width_correction;
      preview[("image" + i)].p1.small_picture_bg_height_correction = small_picture_bg_height_correction;
      preview[("image" + i)].p1.small_picture_pic_width_correction = small_picture_pic_width_correction;
      preview[("image" + i)].p1.small_picture_pic_height_correction = small_picture_pic_height_correction;
      coll_position++;
      if(coll_position == colls){
         row_position++;
         coll_position = 0;
      }
      if(row_position == rows){
         row_position = 0;
      }
   }
   i++;
}
if(!draw_menu){
   but_height = parseInt(cats_buttons.category_but._height);
   but_width = parseInt(cats_buttons.category_but._width);
   but = 0;
   while(_root[("cat_" + but)]){
      cats_buttons.category_but._visible = 0;
      duplicateMovieClip(cats_buttons.category_but, [("category_but" + but)], but);
      if(menu_position == "vertical"){
         cats_buttons[("category_but" + but)]._y = (but_height + menu_offset) * but;
      }
      if(menu_position == "horizontal"){
         cats_buttons[("category_but" + but)]._x = (but_width + menu_offset) * but;
      }
      cats_buttons[("category_but" + but)].category = but;
      cats_buttons[("category_but" + but)].button_text_animation.cats.text = _root[("cat_" + but)];
      cats_buttons[("category_but" + but)].button_text_animation2.cats.text = _root[("cat_" + but)];
      but++;
      var draw_menu = true;
   }
}
draw_pages = false;
if(draw_pages == false){
   var k = 0;
   k = 1;
   while(pages_listing[("num" + k)]){
      pages_listing[("num" + k)].removeMovieClip();
      k++;
   }
   while(_root[((("cat_" + category) + "_pic_") + k)]){
      k++;
   }
   pages_quant = k / (colls * rows);
   var pages_num = parseInt(pages_quant);
   if(parseInt(pages_quant) != pages_quant){
      pages_num++;
   }
   k = 1;
   while(k <= pages_num){
      duplicateMovieClip(pages_listing.page_num, [("num" + k)], k);
      pages_listing.page_num._visible = 0;
      pages_listing[("num" + k)].number = (k - 1) * colls * rows;
      pages_listing[("num" + k)].page_num_animation.page_text = k;
      pages_listing[("num" + k)].page_num_animation.txt.autoSize = "left";
      pages_listing[("num" + k)].hit._width = pages_listing[("num" + k)].page_num_animation.txt._width;
      pages_listing[("num" + k)]._x = (pages_listing[("num" + k)]._width - 10) * k;
      pages_listing[("num" + k)]._x +=  10 * k;
      k++;
   }
}
var draw_pages = true;
if(pages_num == 1){
   page_back_clip._visible = 0;
   page_next_clip._visible = 0;
   pages_listing._visible = 0;
   listing_bg._visible = 0;
}
if(pages_num != 1){
   page_back_clip._visible = 1;
   page_next_clip._visible = 1;
   pages_listing._visible = 1;
   listing_bg._visible = 1;
}
if(y_offset == "true"){
   if(y_position == "top"){
      big_image._y = 0;
      preview._y = big_height + big_image_y_offset;
   }
   if(y_position == "bottom"){
      preview._y = 1;
      big_image._y = big_image_y_offset + (rows * (maxHeight + v_space) - v_space);
   }
}
if(x_offset == "true"){
   if(x_position == "right"){
      preview._x = 0;
      big_image._x = (colls * (maxWidth + h_space) - h_space) + big_image_x_offset;
   }
   if(x_position == "left"){
      big_image._x = 0;
      preview._x = big_width + big_image_x_offset;
   }
}
if(!c){
   page_back_clip._y = gallery_height - page_back_clip._height;
   pages_listing._y = gallery_height - pages_listing._height;
   page_next_clip._y = gallery_height - page_next_clip._height;
   page_back_clip._x = parseFloat(_root.page_back_correction);
   page_next_clip._x = (gallery_width - page_next_clip._width) + parseFloat(_root.page_next_correction);
   pages_listing._x = (gallery_width - pages_listing._width) / 2;
   listing_bg._width = gallery_width - 2;
   listing_bg._height = listing_height;
   listing_bg._x = 1;
   listing_bg._y = page_back_clip._y;
   var c = true;
}
if(!resize_param){
   big_image.big_image_mask._x +=  parseInt(_root.preview_x_correction);
   big_image.big_image_mask._y +=  parseInt(_root.preview_y_correction);
   big_image.big_image_mask._height = big_height + parseInt(_root.preview_height_correction);
   big_image.big_image_mask._width = big_width + parseInt(_root.preview_width_correction);
   var resize_param = "true";
}
big_image.big_cont_bg._height = big_image.big_image_mask._height;
big_image.big_cont_bg._width = big_image.big_image_mask._width;
big_image.zoom._x = parseInt(_root.zoom_x);
big_image.zoom._y = parseInt(_root.zoom_y);
if(_root.template_help_preview != "true"){
   big_image.pic_to_load = (_root[("cat_" + category)] + "/big/") + _root[((("cat_" + category) + "_pic_") + img_start)];
}
if(_root.template_help_preview == "true"){
   big_image.pic_to_load = (((_root.url + "_") + _root[("cat_" + category)]) + "_big_") + _root[((("cat_" + category) + "_pic_") + img_start)];
}
big_image.picture_comment = _root[((("cat_" + category) + "_comment_") + img_start)];
big_image.category = _root[("cat_" + category)];
big_image.play();
preview._visible = 1;
big_image._visible = 1;
if(pages_num != 1){
   listing_bg._visible = 1;
   page_back_clip._visible = 1;
   page_next_clip._visible = 1;
   pages_listing._visible = 1;
}
cats_buttons._visible = 1;
stop();


Uffffpor fin!!! siento el tostón, pero necesito un poco de ayuda para poder hacer funcionar la galería cargada externamente.
GRACIAS.

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 13 Ene 2009 04:07 pm
Por cierto a las etiquetas s1 y s2 dentro de los botones no le hecheis mucha cuento pq como podeis ver son animaciones para cuando pones el ratón encima o lo quitas...

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 14 Ene 2009 05:54 am
WTF? :shock:
Cuando te dije que postearas el código que usas para cargar los datos, me refería exactamente a eso, no a que pusieras todo el código de la librería. Si sabes cuál es, postéalo de nuevo, si no, avisa, pero tendrás que esperar a que yo o alguien más tenga tiempo de verlo.

Por The Fricky!

Presidente

6168 de clabLevel

3 tutoriales
8 articulos

Genero:Masculino   Bastard Operators From Hell Héroes

Piccola Venezia...

firefox
Citar            
MensajeEscrito el 14 Ene 2009 09:14 am
Hola de fricky! gracias de nuevo por contestar...
Estoy siguiendo otro procedimiento pero hay tantos subniveles que me hago la picha un lio...
estoy cambiendo _root. por los _parent. que son necesarios para llegar al nivel 0, el caso es que me acabo de quedar de piedra cuando ya he conseguido cambiar todos y dice que no encuentra la url de donde cargar la galería, y lo he corrgido poniendo _parent._parent en 1er nivel, creia que para llegar desde el nivel 1 al nivel 0 solo tenía que usar un _parent, me equivocaba???

Ejemplo.
Linea principal de tiempo, en esta un MC llamado pages, y dentro de MC pages en el 4º fotograma un MC gallery que sin entrar en él, es decir aun en MC pages, contiene este codigo.

Código ActionScript :

onClipEvent(load){
   function check_loaded(){
      if(_root.comment_position){
         _parent.gallery.gotoAndStop(2);
      }
   }
   if(!_root.comment_position){
      loadVariablesNum(((_root.url + "_gallery.") + _root.file_option), 0);
      _parent.gallery.stop();
      intervalID = setInterval(check_loaded, 100);
   }
}


aqui pensaba que debería sustituir _root. por _parent, pero no es así, funciona cuando sustituyo _root. por _parent._parent.

Y otra duda es que en esta estructura...
Linea principal de tiempo, en esta un MC llamado pages, y dentro de MC pages en el 4º fotograma "VACIO" contiene el mismo codigo.

¿La sustitución de_root. seria la misma _parent._parent o por el contrario como no hay MC en ese fotograma sería _parent?

A ver si me aclaras pq estoy soñando con niveles dentro de niveles dentro de niveles...

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 14 Ene 2009 03:17 pm
Sigo loquito, pruebo mil cosas y nada...
A ver... pregunto, tendra que ver con la forma de cargar la galería, lo hago asi...

Código ActionScript :

proyectos1_btn.proyectos_btn.onRelease = function() {
   nocache = "?nocaching="+random(65000);
   caja_mc.unLoadMovie();
   precargador_mcl.loadClip("proyectos.swf"+nocache, caja_mc);
};

Por brigi

48 de clabLevel



 

Sevilla

msie
Citar            
MensajeEscrito el 04 Feb 2011 11:01 pm
Hola, es de éste mismo código les comento que agregué más categorías a la galería pero todas las carga en una sola columna y de manera vertical, qué debo agregar en el php o en el as3 para que cargue las categorías en columnas? Ojalá alguien pueda contestarme, saludos y gracias

Por redsky

3 de clabLevel



Genero:Femenino  

chrome

 

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