I have this xml photo gallery from a while back that works fine as long as the buttons are not in contact with the images.
I now want the image to occupy the whole area with the buttons on top. But when I place the buttons over where the image lands they disappear. They function and you can see them temporarily when the images are crossfading.
I think it has to do with bringing the depth of the emptymovieclip down but I don’t know how.
Here is the code:
var myIm:Array = [];
// This is the myIm array, stores each image's information
var len:Array = [];
// This is the myIm array, gets the XML length
var loadXML:XML = new XML();
// Create a new XML
loadXML.load("./images.xml");
// Load in the images XML
loadXML.ignoreWhite = true;
// Disregard white space
loadXML.onLoad = function() {
// When the XML loads
len = this.firstChild.childNodes;
// Get the XML and put it into an unorganised array (only to collect length)
for (var j:Number = 0; j<len.length; j++) {
currentInf = this.firstChild.childNodes[j].attributes;
// Get the current images XML attributes
myIm[j] = {url:currentInf.url, y:currentInf.ypos, x:currentInf.xpos, comments:currentInf.comment};
// Get the current images XML attributes and put them into an organised array
}
nextIm();
// Load in the first image
xmlprog = "";
// Remove Loading XML text
};
var i:Number = -1;
// Begin the slideshow at image 0 (-1 + 1), (set "i" to 0, i will store the current image)
last.curVal = "Previous";
// Display the text "Previous" in the previous button
fadeOut = function (which:MovieClip):Void {
which._alpha>0 ? which._alpha -= 5 : which.removeMovieClip();
// If this movie clips alpha is greater than 0, fade out
// Otherwise, remove the movie clip
};
fadeIn = function (which:MovieClip):Void {
delete _root.onEnterFrame;
// Stop preloader
last.onPress = next.onPress=null;
// Disallow the press events for the buttons
which._alpha<100 ? which._alpha += 10 : (which._alpha=100, last.onPress=lastIm, next.onPress=nextIm);
// If this movie clips alpha is smaller than 100, fade in
// Otherwise, set the alpha to 100, and re-allow button presses
};
function nextIm():Void {
i<myIm.length-1 ? i++ : i=0;
// If this image is not the last one, increase the "i" variable by one
// Otherwise, set the "i" variable to 0
loadPic();
// Call the "loadPic" function
}
function lastIm():Void {
i>0 ? i-- : i=myIm.length-1;
// If this image is the first one, set the "i" variable down 1
// Otherwise, set the "i" variable to the highest amount
loadPic();
// Call the "loadPic" function
}
function beginLoad():Void {
last.onPress = next.onPress=null;
// Disallow thye press events for the buttons
bar._visible = true;
// Show the preloader
gL = newPix.getBytesLoaded();
// Get the amount loaded of this picture
gT = newPix.getBytesTotal();
// Get the amount total of this picture
bar._xscale = gL/gT*100;
// Scale the preloader bar to the percentage loaded
if (bar._xscale == 100) {
// If 100% loaded
newPix._alpha = 0;
// Set the new picture to 0% alpha
newPix._x = 0*.x;
// Move to the Y position
newPix._y = 0*.y;
// Move to the X position
bar._xscale = 0;
// Set the preloader back to 0 scale
myIm[i+1].url ? aheadLoader.loadMovie(myIm[i+1].url) : null;
// Load in the next image
aheadLoader._alpha = 0;
// Hide the loader
newPix.onEnterFrame = function() {
fadeIn(this);
// Start fading in
bar._visible = false;
// Hide loader
};
}
}
function loadPic():Void {
newPix.onEnterFrame = function() {
fadeOut(this);
// Start fading out
};
// Fade out the current "newPix" movie clip
newPix = createEmptyMovieClip("pic"+i, i+100*100);
// Create a parent MC for the images
newPix.loadMovie(myIm*.url);
// Load in the images
showComments = myIm*.comments;
// Display Image comments
this.onEnterFrame = beginLoad;
// Attach the next image and store it as "newPix",
// X position of 0, Y position of 0, alpha of 0, and it's initial state to fade in
i == myIm.length-1 ? (next.curVal="Replay", next.gotoAndStop(2)) : (next.curVal="Next", next.gotoAndStop(1));
// If this image is the last one, display the text "Replay" and go to frame 2
// Otherwise, display the text "Next" and go to frame 1
showVals = "Displaying "+(i+1)+" of "+len.length+" image(s)";
// Display image number
}
createEmptyMovieClip("aheadLoader", 0);
// Create a parent MC to load the next image
Any help will be greatly appreciated.
thanks…