Topic: Before and After Image
First of all I have to say that this image gallery is excellent and I've found it very easy to implement.
However, I'm struggling to add in a bit of functionality that I need. I'm trying to customise the code to show a before and after image so that it displays a re-touched photo whenever you click on the gallery thumbnail and then you have the option to click on a link to display the 'before' image. Hence I've added in some extra attributes to the XML i.e.
<image>
<filename>115-1503_IMG.jpg</filename>
<caption>Caption 1</caption>
<beforefilename>115-1503_before_IMG.jpg</beforefilename>
<beforecaption>Caption 1</beforecaption>
</image>
I've added in the relevant bits to the XMLManager.as to pull out the beforefilenames i.e.
imageBeforeFileNames.push(resultNode.childNodes[2].firstChild.nodeValue);
imageBeforeCaptions.push(resultNode.childNodes[3].firstChild.nodeValue);
In ImageArea.as I have modified the code to add to a separate mBeforeImages[i] array i.e.
mBeforeImages[i] = new Image(mBeforeImageHolder_mc, i, mXMLManager.imagePath + mXMLManager.imageBeforeFileNames[i],this);
...and then in the showImage function I've added some script to call another function to load the 'before image' i.e.
mShowBeforeBtn.doAction = Delegate.create(this, onClickLoadBeforeImage);
this is the onClickLoadBeforeImage function:
private function onClickLoadBeforeImage():Void{
//trans out old img
mImages[mCurrentImageIndex].hideImage();
mBeforeImages[mCurrentImageIndex].showImage();
}
Unfortunately the 'before image' doesn't load. If I do a trace on the 'before image' filename then it shows the correct filename i.e.
trace (mXMLManager.imagePath + mXMLManager.imageBeforeFileNames[mCurrentImageIndex]);
So it's extracting the correct filename from the XML but somewhere in ImageArea.as I'm going wrong.
Any help on this would be really appreciated!!!
Many thanks in advance.
Mike