I'm new to action script coding and i had found a tutorial to create a flash slideshow which worked great, but now i'm trying to add links to each slide and i can't find a tutorial that i can figure out to work with my existing coding.
i've added the link and target attributes to my xml file:
<?xml version="1.0" encoding="utf-8"?>
<SLIDESHOW SPEED="2">
<IMAGE URL="photowed.png" link="photowed.htm" target="_self"/>
<IMAGE URL="photofam.png" link="photofam.htm" target="_self"/>
<IMAGE URL="photochild.png" link="photochild.htm" target="_self"/>
<IMAGE URL="photorand.png" link="photorand.htm" target="_self"/>
</SLIDESHOW>
what do i have to add to my actionscript to make it work?
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var my_speed:Number;
var my_total:Number;
var my_images:XMLList;
var my_loaders_array:Array = [];
var my_success_counter:Number = 0;
var my_playback_counter:Number = 0;
var my_slideshow:Sprite = new Sprite();
var my_image_slides:Sprite = new Sprite();
var my_timer:Timer;
var my_xml_loader:URLLoader = new URLLoader();
my_xml_loader.load(new URLRequest("photogallery.xml"));
my_xml_loader.addEventListener(Event.COMPLETE, processXML);
function processXML (e:Event):void{
var my_xml:XML = new XML(e.target.data);
my_speed=my_xml.@SPEED;
my_images=my_xml.IMAGE;
my_total=my_images.length();
loadImages();
}
function loadImages():void{
for (var i:Number = 0; i < my_total; i++){
var my_url:String = my_images[i].@URL;
var my_loader:Loader = new Loader();
my_loader.load(new URLRequest(my_url));
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
my_loaders_array.push(my_loader);
}
}
function onComplete(e:Event):void{
my_success_counter++;
if (my_success_counter == my_total){
startShow();
}
}
function startShow():void{
addChild(my_slideshow);
my_slideshow.addChild(my_image_slides);
nextImage();
my_timer = new Timer(my_speed*1000);
my_timer.addEventListener(TimerEvent.TIMER, timerListener);
my_timer.start();
}
function nextImage():void{
var my_image:Loader = Loader(my_loaders_array[my_playback_counter]);
my_image_slides.addChild(my_image);
my_image.x = (stage.stageWidth - my_image.width)/2;
my_image.y = (stage.stageHeight - my_image.height)/2;
new Tween(my_image,"alpha",Strong.easeOut,0,1,1,true);
}
function timerListener (e:TimerEvent):void{
my_playback_counter++;
if (my_playback_counter == my_total){
my_playback_counter =0;
}
nextImage();
}
any help would be appreciated
