Log in

View Full Version : XML image linking



mebemunky
08-07-2009, 04:00 PM
I'm having trouble figuring out how to get this image slideshow to have separate links for each picture. I've researched online and I can't seem to make sense of what I've found in relation to the code I have.
AS2.0:

import mx.transitions.Tween;
import mx.transitions.easing.*;

var myShowXML = new XML();
myShowXML.ignoreWhite = true;
myShowXML.load("slideshow.xml");

myShowXML.onLoad = function() {
_root.myWidth = myShowXML.firstChild.attributes.width;
_root.myHeight = myShowXML.firstChild.attributes.height;
_root.mySpeed = myShowXML.firstChild.attributes.speed;
_root.myImages = myShowXML.firstChild.childNodes;
_root.myImagesNo = myImages.length;
createContainer();
callImages();
};

function callImages() {
_root.myMCL = new MovieClipLoader();
_root.myPreloader = new Object();
_root.myMCL.addListener(_root.myPreloader);
_root.myClips_array = [];
_root.myPreloader.onLoadComplete = function(target) {
_root.myClips_array.push(target);
target._alpha = 0;
if (_root.myClips_array.length == _root.myImagesNo) {
_root.myText_txt._y = myContainer_mc._y + myContainer_mc._height;
_root.target_mc = -1;
moveSlide();
myShowInt = setInterval(moveSlide, (_root.mySpeed*500)+500);
}
};
for (i=0; i<_root.myImagesNo; i++) {
temp_url = _root.myImages[i].attributes.url;
temp_mc = myContainer_mc.createEmptyMovieClip(i, myContainer_mc.getNextHighestDepth());
_root.myMCL.loadClip(temp_url,temp_mc);
}
}
function moveSlide() {
current_mc = _root.myClips_array[_root.target_mc];
new Tween(current_mc, "_alpha", Strong.easeOut, 100, 0, 4, true);
_root.target_mc++;
if (_root.target_mc>=_root.myImagesNo) {
_root.target_mc = 0;
}
next_mc = _root.myClips_array[_root.target_mc];
new Tween(next_mc, "_alpha", Strong.easeOut, 0, 100, 4, true);
}

My XML

<slideshow width="345" height="375" speed="3">
<image url="images/featured/auto_mechanic.jpg" />
<image url="images/featured/criminal_justice.jpg" />
<image url="images/featured/medical_assisting.jpg" />
<image url="images/featured/paralegal.jpg" />
<image url="images/featured/computer_science.jpg" />
</slideshow>

What do I need to add to make this work?
Thanks in advance!