Comunidad de diseño web y desarrollo en internet online

Cualquier ayuda es agradecida, problema con el código

Citar            
MensajeEscrito el 07 Feb 2010 09:24 pm
He conseguido descargarme un archivo .fla de una galeria de imagenes circular, el problema que tengo es que cada vez que se pulsa una imagen me salta un url, sacado de un archivo XML. Me gustaria, que cada vez que pulse la imagen me cargara un SWF en un contenedor, ya que quiero darle una funcion diferente a la galería. os dejo el texto de accion, os agradeceria cualquier ayuda pues es para una página de apoyo a la cultura con fines sociales, vamos gratuita y mis conocimientos son basicos. Gracias a todos.


flashmo_graphic.visible = false;
link_title.text = "";
link_description.text = "";
loading_info.text = "cargando...";

var folder:String = "swf/thumbnails/";
var speed:Number = 3; // range from 1 to 10
var radius_x:Number = 350;
var radius_y:Number = 100;
var tn_border:Number = 5;
var tn_border_color:Number = 0xFFFFFF;

var dynamic_speed:Number = 0.00006;
var ratio:Number;
var i:Number;
var tn:Number = 0;
var current_no:Number = 0;
var total_items:Number;
var flashmo_xml:XML;
var flashmo_tn_list = new Array();
var mc:MovieClip = new MovieClip();
var thumbnail_group:MovieClip = new MovieClip();
this.addChild(thumbnail_group);

if( speed > 10 || speed < 1 ) speed = 5;

function load_gallery(xml_file:String):void
{
var xml_loader:URLLoader = new URLLoader();
xml_loader.load( new URLRequest( xml_file ) );
xml_loader.addEventListener(Event.COMPLETE, create_gallery);
}

function create_gallery(e:Event):void
{
flashmo_xml = new XML(e.target.data);
total_items = flashmo_xml.thumbnail.length();

for( i = 0; i < total_items; i++ )
{
flashmo_tn_list.push( {
filename: flashmo_xml.thumbnail[i].filename.toString(),
title: flashmo_xml.thumbnail[i].title.toString(),
description: flashmo_xml.thumbnail[i].description.toString(),
url: flashmo_xml.thumbnail[i].url.toString(),
target: flashmo_xml.thumbnail[i].target.toString()
} );
}
load_tn();
}

function load_tn():void
{
var pic_request:URLRequest = new URLRequest( folder + flashmo_tn_list[tn].filename );
var pic_loader:Loader = new Loader();

pic_loader.load(pic_request);
pic_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, tn_progress);
pic_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, tn_loaded);
tn++;
}

function tn_progress(e:ProgressEvent):void
{
loading_info.text = "Cargando " + tn + " de " + total_items;
}

function tn_loaded(e:Event):void
{
var flashmo_tn_bm:Bitmap = new Bitmap();
var flashmo_tn_mc:MovieClip = new MovieClip();

flashmo_tn_bm = Bitmap(e.target.content);
flashmo_tn_bm.smoothing = true;
flashmo_tn_bm.x = - flashmo_tn_bm.width * 0.5;
flashmo_tn_bm.y = - flashmo_tn_bm.height * 0.5;

var bg_width:Number = flashmo_tn_bm.width + tn_border * 2;
var bg_height:Number = flashmo_tn_bm.height + tn_border * 2;

if( tn_border > 0 )
{
flashmo_tn_mc.graphics.beginFill(tn_border_color);
flashmo_tn_mc.graphics.drawRect( - bg_width * 0.5, - bg_height * 0.5, bg_width, bg_height );
flashmo_tn_mc.graphics.endFill();
}

flashmo_tn_mc.addChild(flashmo_tn_bm);
flashmo_tn_mc.name = "flashmo_tn_" + thumbnail_group.numChildren;
flashmo_tn_mc.buttonMode = true;
flashmo_tn_mc.y = -900;

thumbnail_group.addChild( flashmo_tn_mc );

if( tn < total_items )
load_tn();
else
activate_carousel();
}

function activate_carousel():void
{
for( i = 0; i < total_items; i++ )
{
mc = MovieClip( thumbnail_group.getChildByName("flashmo_tn_" + i) );
mc.addEventListener( MouseEvent.MOUSE_OVER, tn_over );
mc.addEventListener( MouseEvent.MOUSE_OUT, tn_out );
mc.addEventListener( MouseEvent.CLICK, tn_click );
mc.addEventListener( Event.ENTER_FRAME, tn_update );
mc.angle = i * ( Math.PI * 2 / total_items );
}
stage.addEventListener( MouseEvent.MOUSE_MOVE, on_move );
stage.addEventListener( Event.ENTER_FRAME, on_update );
loading_info.text = "";
}

function tn_update(e:Event):void
{
mc = MovieClip(e.target);
mc.x = Math.cos(mc.angle) * radius_x;
mc.y = Math.sin(mc.angle) * radius_y;

ratio = ( mc.y + radius_y ) / ( radius_y * 2 );
if( ratio < 0.3 ) ratio = 0.3;

mc.scaleX = mc.scaleY = ratio;
mc.angle += dynamic_speed;
}

function tn_over(e:MouseEvent):void
{
mc = MovieClip(e.target);
current_no = parseInt(mc.name.slice(11,13));

link_title.text = flashmo_tn_list[current_no].title;
link_description.text = flashmo_tn_list[current_no].description;
}

function tn_out(e:MouseEvent):void
{
link_title.text = "";
link_description.text = "";
}

function tn_click(e:MouseEvent):void
{
mc = MovieClip(e.target);
current_no = parseInt(mc.name.slice(11,13));
navigateToURL( new URLRequest( flashmo_tn_list[current_no].url ),
flashmo_tn_list[current_no].target );
}

function on_move(e:MouseEvent):void
{
dynamic_speed = mouseX * speed * 0.00003;
}

function on_update(e:Event):void
{
sort_group(thumbnail_group);
}

function sort_group(group:MovieClip):void
{
var i:int;
var child_list:Array = new Array();

i = group.numChildren;

while(i--)
{
child_list[i] = group.getChildAt(i);
}

child_list.sortOn("y", Array.NUMERIC);
i = group.numChildren;

while(i--)
{
if( child_list[i] != group.getChildAt(i) )
{
group.setChildIndex(child_list[i], i);
}
}
}

Por goonie

12 de clabLevel



 

firefox
Citar            
MensajeEscrito el 07 Feb 2010 09:33 pm
Bueno, no me he leído todo el código, pero la función que dices y tienes que modificar es esta.

Código ActionScript :

function tn_click(e:MouseEvent):void
{
mc = MovieClip(e.target);
current_no = parseInt(mc.name.slice(11,13));
navigateToURL( new URLRequest( flashmo_tn_list[current_no].url ),
flashmo_tn_list[current_no].target );
}


Por lo tanto, lo que deberías hacer es un tuContenedor.addChild de lo que quieras en vez de este código...

Por ur!

256 de clabLevel



 

Barcelona

chrome
Citar            
MensajeEscrito el 08 Feb 2010 04:23 pm
entiendo, lo que quisiera es que cuando pulse una de las imagenes de la galeria, se cargue en un contenedor un archivo swf externo, la cuestion es que no se como hacerlo, podrias indicarme como por favor. Gracias

Por goonie

12 de clabLevel



 

firefox

 

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