Hi there,

I have got hold of this flash code (below) to control the display of images. Currently, when you click the photo, it goes to the next. I'd like to know how you can add a "next" and previous button to control the display of the images... all this in conjunction with what already exist (ie, clicking the photo still send you to the next one).

THANK YOU IN ADVANCE!!

Here's the code:

stop();
import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;

var filename_list = new Array();
var title_list = new Array();

var i:Number;
var tn:Number = 0;
var tween_duration:Number = 0.4;

var fm_tween:Tween;
var total:Number;
var galeria_xml:XML = new XML();
var folder:String = "fotos/";
var xml_loader:URLLoader = new URLLoader();
xml_loader.load(new URLRequest("flash/flukgallery.xml"));
xml_loader.addEventListener(Event.COMPLETE, create_thumbnail);

var thumbnail_group:MovieClip = new MovieClip();
stage.addChild(thumbnail_group);

thumbnail_group.x = tn_group.x;
var default_y:Number = thumbnail_group.y = tn_group.y;

tn_group.visible = false;
tn_title.text = "";

function create_thumbnail(e:Event):void {
galeria_xml = XML(e.target.data);
total = galeria_xml.thumbnail.length();

for (i = 0; i < total; i++) {
filename_list.push( galeria_xml.thumbnail[i].@filename.toString() );
title_list.push( galeria_xml.thumbnail[i].@title.toString() );
}
load_tn();
}

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

pic_loader.load(pic_request);
pic_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_loaded);
tn++;
}

function on_loaded(e:Event):void {
if ( tn < total ) {
load_tn();
tn_title.text = "LOADING " + tn + " OF " + total + " PHOTOS";

} else {
tn_title.text = title_list[0];

var mc:MovieClip = MovieClip( thumbnail_group.getChildAt(total-2) );
mc.addEventListener( MouseEvent.CLICK, go_out );
new Tween(mc, "rotation", Bounce.easeOut, mc.rotation, 0, tween_duration, true);
}

var galeria_bm:Bitmap = new Bitmap();
var galeria_mc:MovieClip = new MovieClip();

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

var bg_width = galeria_bm.width + 14;
var bg_height = galeria_bm.height + 14;

galeria_mc.addChild(galeria_bm);
galeria_mc.graphics.lineStyle(1, 0x000000);
galeria_mc.graphics.beginFill(0xFFFFFF);
galeria_mc.graphics.drawRect( - bg_width * 0.5, - bg_height * 0.5, bg_width, bg_height );
galeria_mc.graphics.endFill();

galeria_mc.name = "galeria_" + thumbnail_group.numChildren;

new Tween(galeria_mc, "x", Strong.easeOut, 200, Math.random() * 20 - 10, tween_duration * 2, true);
new Tween(galeria_mc, "y", Strong.easeOut, -50, Math.random() * 20 - 10, tween_duration * 2, true);
new Tween(galeria_mc, "rotation", Strong.easeOut, 60, Math.random() * 30 - 15, tween_duration * 2, true);

thumbnail_group.addChildAt(galeria_mc, 0);
}

function go_out(e:MouseEvent):void {
var mc:MovieClip = MovieClip(e.target);
mc.removeEventListener( MouseEvent.CLICK, go_out );

fm_tween = new Tween(mc, "x", Strong.easeIn, mc.x, 100, tween_duration, true);
fm_tween.addEventListener(TweenEvent.MOTION_FINISH, go_in);
new Tween(mc, "y", Strong.easeIn, mc.y, -180, tween_duration, true);
}

function go_in(te:TweenEvent):void {
var mc:MovieClip = MovieClip( thumbnail_group.getChildAt(total-1) );
var s_no:Number = parseInt( mc.name.slice(8,10) ) + 1;
if (s_no == total) {
s_no = 0;
}

fm_tween = new Tween(mc, "x", Strong.easeOut, mc.x, Math.random() * 20 - 10, tween_duration, true);
fm_tween.addEventListener(TweenEvent.MOTION_FINISH, add_click);
new Tween(mc, "y", Strong.easeOut, mc.y, Math.random() * 20 - 10, tween_duration, true);
new Tween(mc, "rotation", Regular.easeOut, mc.rotation, Math.random() * 30 - 15, tween_duration, true);

thumbnail_group.addChildAt( mc, 0 );

tn_title.text = title_list[s_no];
}

function add_click(te:TweenEvent):void {
var mc:MovieClip = MovieClip(thumbnail_group.getChildAt(total-1) );
mc.addEventListener( MouseEvent.CLICK, go_out );
new Tween(mc, "rotation", Bounce.easeOut, mc.rotation, 0, tween_duration, true);
}