i have a full flash template that im messing with, and inside i have added as a symbol, a flash gallery. The problem is how to call the gallery each time with different list of the xml. Heres my code, of the symbol flash_gallery, and it has one page alone.
import caurina.transitions.*;
var folder:String;
var i:Number;
var tn:Number = 0;
var current_no:Number = 0;
var no_of_column:Number = 2;
var tween_duration:Number = 0.7;
var total:Number;
var flashmo_xml:XML;
var flashmo_photo_list = new Array();
var flashmo_pic:MovieClip = new MovieClip();
var thumbnail_group:MovieClip = new MovieClip();
this.addChild(flashmo_pic);
this.addChild(thumbnail_group);
this.addChild(flashmo_text_info);
flashmo_pic.x = flashmo_photo_area.x;
flashmo_pic.y = flashmo_photo_area.y;
flashmo_pic.mask = flashmo_photo_area;
thumbnail_group.x = flashmo_thumbnail_area.x;
thumbnail_group.y = flashmo_thumbnail_area.y;
thumbnail_group.mask = flashmo_thumbnail_area;
flashmo_scrollbar.visible = false;
thumbnail_info.text = "";
loading_info.text = "";
flashmo_text_info.alpha = 0;
flashmo_text_info.photo_title.text = "";
flashmo_text_info.photo_description.text = "";
flback.addEventListener( MouseEvent.CLICK, ret_click );
function load_gallery(xml_file:String, no:int):void
{
flashmo_photo_list = new Array();
folder = "photos/psarrakos/" + no + "/"
var xml_loader:URLLoader = new URLLoader();
xml_loader.load( new URLRequest( xml_file ) );
//xml_loader.removeEventListener(
xml_loader.addEventListener(Event.COMPLETE, create_thumbnail);
}
function create_thumbnail(e:Event):void
{
flashmo_xml = new XML(e.target.data);
total = flashmo_xml.photo.length();
for( i = 0; i < total; i++ )
{
flashmo_photo_list.push( {
thumbnail: "thumbs/" +flashmo_xml.photo*.filename.toString(),
filename: flashmo_xml.photo*.filename.toString(),
title: flashmo_xml.photo*.title.toString(),
description: flashmo_xml.photo*.description.toString()
} );
}
trace(flashmo_photo_list.length);
load_tn();
load_photo();
}
function load_photo():void
{
var pic_request:URLRequest = new URLRequest( folder + flashmo_photo_list[current_no].filename );
var pic_loader:Loader = new Loader();
pic_loader.load(pic_request);
pic_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, on_photo_progress);
pic_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_photo_loaded);
flashmo_text_info.photo_title.text = flashmo_photo_list[current_no].title;
flashmo_text_info.photo_description.text = flashmo_photo_list[current_no].description;
flashmo_pic.alpha = 0;
}
function unload_photo():void
{
flashmo_pic.removeChildAt(0);
load_photo();
}
function on_photo_progress(e:ProgressEvent):void
{
var percent:Number = Math.round(e.bytesLoaded / e.bytesTotal * 100);
loading_info.text = "Loading... " + percent + "%";
}
function on_photo_loaded(e:Event):void
{
loading_info.text = "";
flashmo_pic.addChild( Bitmap(e.target.content) );
Tweener.addTween( flashmo_pic, { alpha: 1, time: tween_duration, transition: "linear" } );
}
function load_tn():void
{
var pic_request:URLRequest = new URLRequest( folder + flashmo_photo_list[tn].thumbnail );
var pic_loader:Loader = new Loader();
pic_loader.load(pic_request);
pic_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, on_thumbnail_loaded);
tn++;
thumbnail_info.text = "Loading thumbnail " + tn + " of " + total;
}
function on_thumbnail_loaded(e:Event):void
{
var flashmo_bm:Bitmap = new Bitmap();
var flashmo_mc:MovieClip = new MovieClip();
flashmo_bm = Bitmap(e.target.content);
flashmo_bm.smoothing = true;
var bg_width:Number = flashmo_bm.width + 10;
var bg_height:Number = flashmo_bm.height + 10;
flashmo_mc.addChild(flashmo_bm);
flashmo_mc.name = "flashmo_" + thumbnail_group.numChildren;
flashmo_mc.buttonMode = true;
flashmo_mc.addEventListener( MouseEvent.MOUSE_OVER, tn_over );
flashmo_mc.addEventListener( MouseEvent.MOUSE_OUT, tn_out );
flashmo_mc.addEventListener( MouseEvent.CLICK, tn_click );
flashmo_mc.x = 0;
flashmo_mc.y = thumbnail_group.numChildren * bg_height;
thumbnail_group.addChild(flashmo_mc);
if( tn < total )
{
load_tn();
}
else
{
flashmo_scrollbar.visible = true;
flashmo_scrollbar.scrolling("thumbnail_group", "flashmo_thumbnail_area", 0.25);
thumbnail_info.text = "";
}
}
function tn_over(e:MouseEvent):void
{
var mc:MovieClip = MovieClip(e.target);
var s_no:Number = parseInt(mc.name.slice(8,10));
Tweener.addTween( mc, { alpha: 0.5, time: tween_duration, transition: "easeOut" } );
}
function tn_out(e:MouseEvent):void
{
var mc:MovieClip = MovieClip(e.target);
Tweener.addTween( mc, { alpha: 1, time: tween_duration, transition: "easeIn" } );
}
function tn_click(e:MouseEvent):void
{
var mc:MovieClip = MovieClip(e.target);
var s_no:Number = parseInt(mc.name.slice(8,10));
current_no = s_no;
Tweener.addTween( flashmo_pic, { alpha: 0, time: tween_duration,
transition: "linear", onComplete: unload_photo } );
}
function invisible(): void{
this.visible = false;
}
function ret_click(e:MouseEvent):void
{
/**
var mc = e.target.parent.parent.parent.parent;
var mc2 = e.target.parent.parent.parent;
this.removeChild(flashmo_pic);
this.removeChild(thumbnail_group);
this.removeChild(flashmo_text_info);
this.visible = false;
*/
var children:Number = this.thumbnail_group.numChildren
for (var a:Number = 0; a<children; a++){
this.thumbnail_group.removeChildAt(0);
trace(this.thumbnail_group.numChildren);
}
//trace(mc2.thumbnail_group.numChildren);
Tweener.addTween( this, { alpha: 0, time: tween_duration, transition: "linear", onComplete: invisible } );
//this.visible = false;
MovieClip(this.parent).play();
}
flashmo_pic.addEventListener( MouseEvent.MOUSE_OVER, pic_over );
flashmo_pic.addEventListener( MouseEvent.MOUSE_OUT, pic_out );
function pic_over(e:MouseEvent):void
{
Tweener.addTween( flashmo_text_info, { alpha: 1, time: tween_duration, transition: "easeIn" } );
}
function pic_out(e:MouseEvent):void
{
Tweener.addTween( flashmo_text_info, { alpha: 0, time: tween_duration, transition: "easeOut" } );
}
The problem is after i hit the return button which calls the ret_click, it cant load any other list.
Of course i call on it with the load_gallery function
I would really appreciate if you could help me out.