Hello to everyone !
I am a graphic designer, and I want to make my own website in flash. I know how to work in flash, but as you guess I don’t have the “touch” with actionscript. I managed to understand a few of the principles of how it works, but it’s still a fog in my mind. I don’t intend to learn actionscript, because it’s not going to be a part of what I do and, at least, for now, I don’t have the necessary time. So, by reading a few tutorials, and after watching some videos, I made myself a scheme of how the site will look and work in corelation with actionscript.
My website will be a portfolio, and now I want to make 3 different slideshows, each one coresponding to it’s specific page. I want to make it with .xml so I can update my images easier. So…I found a component which I modified but the script is AS2 and is not working with AS3. So… if anyone could help me, translate this to AS3…if it’s possible.
//the time in miliseconds, which is between images
var slideShowDelay:Number=5000;
//curent position
var curentPosition:Number=0;
//the number of the images, from the xml
var totalImages:Number=0;
var intervalId:Number;
var imagesArray:Array=[]
var isSliding:Boolean=false;
var _xml:XML;
var me=this;
//method used to start the slideshow
function startSlideShow()
{
isSliding=true;
showNextImage();
}
//method used to stop the slideshow
function stopSlideShow()
{
clearInterval(intervalId);
isSliding=false;
}
//method used to play the next image from the slideshow
function showNextImage()
{
loadImage(curentPosition+1);
}
//method used to play the previous image from the slideshow
function showPreviousImage()
{
loadImage(curentPosition-1);
}
/**
method used to jump to a specified index
usage: loadImage(3);
*/
function loadImage(nr:Number)
{
//cecking if the nr is between 0 and totalImage
if(nr>totalImages-1)
nr=0;
if(nr<0)
nr=totalImages;
//set the curent position to the new one
curentPosition=nr;
//start loading the new image
me.ldr.contentPath=me.imagesArray[curentPosition];
//clear the interval used for slideshow
clearInterval(me.intervalId)
}
//a listener, used to know when the transition has finished
var obj={};
obj.onTransitionEnd=function()
{
if(me.isSliding==true)
me.intervalId = setInterval(me,"showNextImage", me.slideShowDelay )
}
ldr.addEventListener("onTransitionEnd", obj)
//loading the xml file.
_xml=new XML();
_xml.load("test.xml")
_xml.ignoreWhite=true
_xml.onLoad=function(succes)
{
if(succes)
{
//parsing the xml, and push the images path to imagesArray
for(var aNode=this.firstChild.firstChild;aNode!=null; aNode=aNode.nextSibling)
{
me.imagesArray.push(aNode.attributes.path);
}
me.totalImages=this.firstChild.childNodes.length;
//start the slideshow
me.startSlideShow();
}
}