//Adopted from a tutorial on how to create a Flash slide show using an XML data file //http://www.republicofcode.com/tutorials/flash/as3slideshow/ //Original Author: Riyadh Al Balushi //Comments:Brian Milinski import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; import flash.display.Loader; import flash.display.Sprite; //The image transition effects are imported with the following libraries... the Tween Class. import fl.transitions.Tween; import fl.transitions.easing.*; import fl.transitions.TweenEvent; import flash.utils.Timer; import flash.events.TimerEvent; import flash.text.TextField; //End image transition effect libraries. //These variables will be extracted from the XML file. var speed:Number; //Must be Multiplied by 1000 because it comes in as milliseconds from the XML file.. see when it is used with the Timer ...timerT. var totalSlides:Number; var successfulImages:Number = 0; var images:XMLList; //XMLList of images..dynamically loaded to allow more image tags to be added as needed var loadersArray:Array = []; var slideShow:Sprite = new Sprite(); //Sprites are used for displaying things on the "stage" or screen var imageSlides:Sprite = new Sprite(); var playBackCounter:Number = 0; var timerT:Timer; var xmlLoader:URLLoader = new URLLoader(); xmlLoader.load(new URLRequest("slideshow.xml")); //load our xml file to get the images xmlLoader.addEventListener(Event.COMPLETE,processXML); //Once the xml file is loaded go to the processXML function //XML file is loaded at this point... //Function: processXML //Purpose: Process the XML data in order to import it into flash. function processXML (e:Event):void{ var xmlLoader:XML = new XML(e.target.data); //using var inside of a function makes it a temporary memory holder speed = xmlLoader.@SPEED;//How fast the slideshow is set in the XML file...the SLIDESHOW tag has a SPEED setting in the XML file. images = xmlLoader.IMAGE;//get all the images totalSlides = images.length(); //the number of images in the XML List loadImages(); //Go to the load Images Function. } //Function: loadImages //Puropse: load images into flash! adds an event handler and fires the onComplete function upon loading an image function loadImages():void{ for( var i:Number = 0; i