hello i got a slideshow that gets its data from XML and it now works with no errors. Also if you click anywhere on the body it will also link to a page designated in the xml.
I would like to add buttons to the file. I was hoping to add them dynamically based on the number of nodes in the xml file. I got a variable that gets the number of nodes already.
How would i go about doing this? Array that spins out the buttons? i was thinking that would work but i have no idea how to bring them to the stage. The buttons would allow selection of the slide node.
I have saw a slideshow with thumbnails and assumed the same logic should work to put them together but i dont have code for it.
Here is the code i got for the slideshow:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var xmlloader:URLLoader;
var xmlpath = "bar.xml";
var myXML:XML;
var picIndex = 0;
var slideTimer:Timer = new Timer(4000);
var slideTimer1:Timer = new Timer(1000);
var slideTimer2:Timer = new Timer(0100,1);
var intSlideCount:int;
function xmlLoaded():void {
xmlloader = new URLLoader();
xmlloader.addEventListener(Event.COMPLETE,xmlloadcomplete);
xmlloader.load(new URLRequest(xmlpath));
}
function xmlloadcomplete(e:Event):void {
myXML = new XML(e.target.data);
//imageSource.source = "photos/"+myXML.bar[0].photo;//loads 1st image //remove if i can get slideshow to start with image
trace(myXML);//shows in my out put that im getting the xml data //remove when working or comment out
intSlideCount = myXML..bar.length();
trace(intSlideCount);
}
function fadein(event:TimerEvent) {
slideTimer.start();
slideTimer1.stop();
imageSource.source = "photos/"+myXML.bar[picIndex].photo;
var textFade = new Tween(imageSource,"alpha",None.easeNone,.5,1,1,true);//fade in
picIndex ++;
//set it to zero when it reaches your maximum index which currently is 3
if (picIndex == intSlideCount) {
picIndex =0;
}
slideTimer.addEventListener(TimerEvent.TIMER, fadeout);
}
function fadeout(event:TimerEvent):void {
var textFade1 = new Tween(imageSource, "alpha",None.easeNone,1,.5,1,true);//fades out
slideTimer1.start();
slideTimer1.addEventListener(TimerEvent.TIMER, fadein);
}
function loadurl(event:MouseEvent):void {
trace(myXML.bar[picIndex].link);
var urlchange:URLRequest = new URLRequest(myXML.bar[picIndex].link);//
navigateToURL(urlchange);
}
xmlLoaded();
slideTimer2.start();
slideTimer2.addEventListener(TimerEvent.TIMER, fadein);
imageSource.addEventListener(MouseEvent.CLICK, loadurl);