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

Espero que sea pregunta facil!

Estas en el tema de Espero que sea pregunta facil! en el foro de Flash y Actionscript en Foros del Web. Hola!! Quería crear para una web como una galería de imágenes, pero que al hacer click sobre las imágenes se abra un .pdf en otra ...
  #1 (permalink)  
Antiguo 05/03/2009, 18:41
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Espero que sea pregunta facil!

Hola!!

Quería crear para una web como una galería de imágenes, pero que al hacer click sobre las imágenes se abra un .pdf en otra página.

Este tipo de galería quería que fuese en XML para así ser facilmente actualizable, y poder añadir y quitar .pdf sin necesidad de tocar el flash.

Mi problemas es, que tengo galerias hechas con XML, pero nose donde ni como poner la acción para que abra el pdf.

Los pdf tengo claro que debería subirlos al servidor para llamarlos como si fueran imágenes.


¿¿¿¿El código que debería poner en XML para que se me abriera el pdf sería algo así????
(he puesto dos posibilidades, una para cada foto)


<?xml version="1.0" ?>
<menu>

<link title="Imagen 1" desc="FOTO 1" img="01.jpg" link="1.pdf"/>

<link title="Imagen 2" desc="FOTO 2" img="02.jpg" link="http//......../1.pdf"/>

<menu>

¿¿¿O no se hace así?? ME PODEIS AYUDAR!???

Si lo pruebo publicado en flash, ya debería de abrirse no???? o necesito colgarlo??

Muchas gracias!
  #2 (permalink)  
Antiguo 05/03/2009, 19:03
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

Necesitas subir el XML al servidor y subir tus pdf´s.
  #3 (permalink)  
Antiguo 06/03/2009, 03:43
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Ok Diegoazul, pero de que formas los debo llamar con el XML??????
  #4 (permalink)  
Antiguo 06/03/2009, 13:03
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

Si debes llamarlo , lee aquí http://www.cristalab.com/tutoriales/...en-flash-c12l/ si tienes más dudas vienes y preguntas.
  #5 (permalink)  
Antiguo 08/03/2009, 15:16
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Hola Diego azul, creo q me he explicado mal.. llamar al xml si sé. Mi problema es, que nose cómo poner en el archivo xml que se debe abrir un pdf determinado al hacer click sobre las distintas imágenes de la galería.
  #6 (permalink)  
Antiguo 08/03/2009, 17:24
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

Ok postea el XML (usa las etiquedas code del foro), y postea el codigo AS que usas para cargar ese xml.
  #7 (permalink)  
Antiguo 08/03/2009, 17:46
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Hola de nuevo DIegoazul, gracias por tu ayuda.

Aqui va el código que llama al XML


Cita:
//

getXML = function (){
xmlDoc = new XML();
xmlDoc.ignoreWhite = true;
xmlDoc.load("menu.xml");
xmlDoc.onLoad = function (){
totalJ = xmlDoc.firstChild.childNodes.length;
item._visible = false;
itemGenerate = 0;
intervalGeneration = setInterval(generation, 10);
};
};

//

y este el del XML


Cita:
<?xml version="1.0" ?>
<menu>

<link title="01. BUTTON TITLE" desc="Description Text 01 more text" img="01.jpg" link="img/1.pdf"/>

<link title="02. BUTTON TITLE" desc="Description Text 02" img="02.jpg" link="http://................../1.pdf"/>

<link title="03. BUTTON TITLE" desc="Description Text 03 more text" img="03.jpg" link="1.pdf"/>

<link title="04. BUTTON TITLE" desc="Description Text 04" img="04.jpg" linkTo="http://..................../1.pdf"/>


</menu>
como ves he intentado abrir el pdf de distintas formas, pero no me funciona!
ves algo raro???
  #8 (permalink)  
Antiguo 08/03/2009, 17:51
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

Escribe la función que se llama generation
  #9 (permalink)  
Antiguo 08/03/2009, 17:56
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

esta???



Cita:
generate = function (j)
{
this.attachMovie("item", "item" + j, j);
this["item" + j].id = j;
loadImage(j, xmlDoc.firstChild.childNodes[j - 1].attributes.img);
title = xmlDoc.firstChild.childNodes[j - 1].attributes.title;
by = xmlDoc.firstChild.childNodes[j - 1].attributes.desc;
link = xmlDoc.firstChild.childNodes[j - 1].attributes.link;
var title2 = title;
var by2 = by;
var link2 = link;
this["item" + j]._yscale = 0;
this["item" + j]._xscale = 0;
Tweener.addTween(this["item" + j], {_xscale:100, _yscale:100, time:0.8, delay:0.1*j, transition:"easeInOutExpo"});
this.attachMovie("Tip", "toolTip", 1000);
toolTip.tipMask._width = 0;

this["item" + j].onRollOver = function() {
_root.toolTip.texts.titleText.text = title2;
_root.toolTip.texts.byText.text = by2;
bot_sound.start();
Tweener.addTween(toolTip, {_x:this._x + 20, _y:this._y - 20, time:0.1, rounded:true, transition:"easeOutExpo"});
Tweener.addTween(toolTip.tipBg, {_width:toolTip.texts._width + 30, time:0.3, transition:"easeOutExpo"});
Tweener.addTween(toolTip.tipMask, {_width:toolTip.texts._width + 30, time:0.5, delay:0.1, transition:"easeInOutExpo"});
Tweener.addTween(this.maskImg, {_width:100, _height:100, time:0.2, transition:"easeOutExpo"});
Tweener.addTween(this.botBg, {_width:110, _height:110, time:0.3, transition:"easeOutBack"});
};
this["item" + j].onRollOut = this["item" + j].onReleaseOutside = function() {
Tweener.addTween(this.maskImg, {_width:70, _height:70, time:0.3, transition:"easeOutBack"});
Tweener.addTween(this.botBg, {_width:70, _height:70, time:0.3, transition:"easeOutBack"});
Tweener.addTween(toolTip.tipMask, {_width:0, time:0.1, transition:"easeOutExpo"});
};
this["item" + j].onPress = function() {
Tweener.addTween(this.maskImg, {_xscale:70, _yscale:70, time:0.3, transition:"easeOutBack"});
Tweener.addTween(this.botBg, {_width:70, _height:70, time:0.3, transition:"easeOutBack"});
diff = this.id - _root.itemReal;
_root.itemActive = _root.itemActive + diff;
_root.itemReal = this.id;
_root.refreshItemActive();
//action for external link
//getURL (link2, "_blank");
//action for loadMovie (need to create a new movie clip with the instance "contentMovie")
//loadMovie (link2, contentMovie);
//DEMO ACTION
linkText.text = link2;
};
};
  #10 (permalink)  
Antiguo 08/03/2009, 18:05
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

No, hay una función que setInterval ejecuta y se llama generation

setInterval(generation, 10);
  #11 (permalink)  
Antiguo 08/03/2009, 18:06
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Cita:
//

generation = function (){
++itemGenerate;
generate(itemGenerate);
around();
if (itemGenerate == totalJ){
clearInterval(intervalGeneration);
}
};

//

cierto perdona!
  #12 (permalink)  
Antiguo 08/03/2009, 18:10
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

. .
  #13 (permalink)  
Antiguo 08/03/2009, 18:27
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

ok ve a la libreria y te metes al clip que se llama item y dentro de el declaras una variable en un frame vacio con nombre:

Código:
var pdf_str:String

y cambia la funcion generate pos esta:


Código:
generate = function (j)
{
this.attachMovie("item", "item" + j, j);
this["item" + j].id = j;
loadImage(j, xmlDoc.firstChild.childNodes[j - 1].attributes.img);
title = xmlDoc.firstChild.childNodes[j - 1].attributes.title;
by = xmlDoc.firstChild.childNodes[j - 1].attributes.desc;
link = xmlDoc.firstChild.childNodes[j - 1].attributes.link;
//
//
this["item" + j].pdf_str=String(xmlDoc.firstChild.childNodes[0].attributes.link)
//
//
var title2 = title;
var by2 = by;
var link2 = link;
this["item" + j]._yscale = 0;
this["item" + j]._xscale = 0;
Tweener.addTween(this["item" + j], {_xscale:100, _yscale:100, time:0.8, delay:0.1*j, transition:"easeInOutExpo"});
this.attachMovie("Tip", "toolTip", 1000);
toolTip.tipMask._width = 0;

this["item" + j].onRollOver = function() {
_root.toolTip.texts.titleText.text = title2;
_root.toolTip.texts.byText.text = by2;
bot_sound.start();
Tweener.addTween(toolTip, {_x:this._x + 20, _y:this._y - 20, time:0.1, rounded:true, transition:"easeOutExpo"});
Tweener.addTween(toolTip.tipBg, {_width:toolTip.texts._width + 30, time:0.3, transition:"easeOutExpo"});
Tweener.addTween(toolTip.tipMask, {_width:toolTip.texts._width + 30, time:0.5, delay:0.1, transition:"easeInOutExpo"});
Tweener.addTween(this.maskImg, {_width:100, _height:100, time:0.2, transition:"easeOutExpo"});
Tweener.addTween(this.botBg, {_width:110, _height:110, time:0.3, transition:"easeOutBack"});
};
this["item" + j].onRollOut = this["item" + j].onReleaseOutside = function() {
Tweener.addTween(this.maskImg, {_width:70, _height:70, time:0.3, transition:"easeOutBack"});
Tweener.addTween(this.botBg, {_width:70, _height:70, time:0.3, transition:"easeOutBack"});
Tweener.addTween(toolTip.tipMask, {_width:0, time:0.1, transition:"easeOutExpo"});
};
this["item" + j].onPress = function() {
	getURL(this.pdf_str, "_blank");
Tweener.addTween(this.maskImg, {_xscale:70, _yscale:70, time:0.3, transition:"easeOutBack"});
Tweener.addTween(this.botBg, {_width:70, _height:70, time:0.3, transition:"easeOutBack"});

diff = this.id - _root.itemReal;
_root.itemActive = _root.itemActive + diff;
_root.itemReal = this.id;
_root.refreshItemActive();
//action for external link
//getURL (link2, "_blank");
//action for loadMovie (need to create a new movie clip with the instance "contentMovie")
//loadMovie (link2, contentMovie);
//DEMO ACTION
linkText.text = link2;
};
};
En teoria deberia funcionar..
  #14 (permalink)  
Antiguo 08/03/2009, 18:28
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

Cita:
Iniciado por NathFly Ver Mensaje
. .
??
  #15 (permalink)  
Antiguo 08/03/2009, 18:30
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

gracias diego, voy a probar y te cuento..

no hagas caso, esto: . . era pq te había escrito otra función y era para borrarla!

voy a ver.... ;)
  #16 (permalink)  
Antiguo 08/03/2009, 18:38
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Graciassss!!!! que bien Diegoazul! Ya me va haciendo lo q me has dicho!
uff.. llevaba un tiempo ya con esto.....!
Muchas gracias por tu ayuda y FELICIDADES por tus conocimientos! ;)
  #17 (permalink)  
Antiguo 08/03/2009, 18:44
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Uyyy, hay un problema, ahora no importa a que imagen clicke, siempre se abre el mismo pdf... ?¿?¿?¿?
  #18 (permalink)  
Antiguo 08/03/2009, 18:53
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

cambia la primera linea roja por esta:
Código:
this["item"+j].pdf_str = xmlDoc.firstChild.childNodes[j-1].attributes.link;

Como no hiciste preguntas, debo entender que has comprendido todo el codigo NathFly ¬¬
  #19 (permalink)  
Antiguo 08/03/2009, 19:05
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

uff, sigue sucediendo lo mismo, pico en las imágenes y siempre sale el "1.pdf" , parece q no haga caso al pdf que dice que abra el xml con cada imagen..!

Del código entiendo muuuuuuy poquito soy principiante y se nada de programación, lo poco vlo oy aprendiendo al ir practicando!
  #20 (permalink)  
Antiguo 08/03/2009, 19:09
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

ya cambiaste las etiquetas XML?:


Código:
<?xml version="1.0" ?>
<menu>

<link title="01. BUTTON TITLE" desc="Description Text 01 more text" img="01.jpg" link="img/1.pdf"/>

<link title="02. BUTTON TITLE" desc="Description Text 02" img="02.jpg" link="http://................../1.pdf"/>

<link title="03. BUTTON TITLE" desc="Description Text 03 more text" img="03.jpg" link="1.pdf"/>

<link title="04. BUTTON TITLE" desc="Description Text 04" img="04.jpg" linkTo="http://..................../1.pdf"/>


</menu>
porque todas apuntan a 1.pdf
  #21 (permalink)  
Antiguo 08/03/2009, 19:16
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Siiii, estaban cambiadas, eran las cookies!!!!!!!
Muchas gracias por tu paciencia!

Y que vivan los foros! jaja!
  #22 (permalink)  
Antiguo 08/03/2009, 19:23
Avatar de Diegoazul  
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 16 años, 10 meses
Puntos: 67
Respuesta: Espero que sea pregunta facil!

De todas formas aunque seas principiante nathfly te recomiendo por experiencia que aprendas programación te ayudara mucho, aprieta f1 en flash, adios!.
  #23 (permalink)  
Antiguo 08/03/2009, 19:26
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Si, lo haré! me doy cuenta de que es importantísimo!, hasta otra!
Buenas noches!
  #24 (permalink)  
Antiguo 08/03/2009, 19:26
 
Fecha de Ingreso: noviembre-2008
Mensajes: 41
Antigüedad: 15 años, 5 meses
Puntos: 0
Respuesta: Espero que sea pregunta facil!

Si, lo haré! me doy cuenta de que es importantísimo!, hasta otra!
Buenas noches!
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 16:24.