Hi people, this is my first post here, so bare with me…
I haven’t coded anything of significance the last few years, but now i’m trying to get into ActionScript 3, and… well, I’m having some problems with a slideshow I’m trying to make.
It loads the slide-data (image, heading, text and a URL for a Read More button) from a xml-file. The problem is that when I’m trying to create the eventlistener for the Read More button, all buttons get the value of the last slide.
Here’s the code
for (i=0; i<max; i++) {
slide = new slideMc();
slide.x = -3000;
slide.y = 0;
slide.alpha = 0;
slide.ready = false;
imgLoader = new Loader();
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoaded);
imgLoader.load(new URLRequest(slideXML.article*.bigArticleImg));
slide.slideImg.addChild(imgLoader);
slide.heading.text = slideXML.article*.heading;
slide.ingress.text = slideXML.article*.ingress;
addChildAt(slide, i);
slideList.push(slide);
slideTable[imgLoader.contentLoaderInfo] = slide;
moreURL = slideXML.article*.readMoreLink;
slideList*.moreBtn.buttonMode = true;
slideList*.moreBtn.addEventListener(MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
var request:URLRequest = new URLRequest(moreURL);
try {
navigateToURL(request, '_self');
} catch (err:Error) {
trace("Error occurred!");
}
}
);
If anyone’s interrested, the files for the project can be downloaded here
If i get the help to finish this, i’ll make the finished slideshow available as a free download if there’s interrest, so others can learn from it.
Thanks!