I used a variation of the tutorial found at: http://www.kirupa.com/web/xml/examples/portfolio.htm to generate a slide show loading images from an .XML everything is working as it should, i would just like to add a couple of items which i am having trouble with. An example of where i am currently at can be found at:
http://www.mzarchitect.com/mz_projects/0313/salvation.html
What i want to add are fade-in and fade-out effects for both the images and the buttons (which are movieclips) as well as a preloader for the images. The latter of the two items being the more important as the images can take a moment to load and i would like an indication that something is happening.
I have some actionscript for the buttons that seems like it should give me the fade-in and fade out effects i want, but it does not work. I also have some preloader code that i have used before, but i cannot seem to figure out where to place it to get to work for each image.
var btn_space = 30;
var btn_array = new Array();
var img_array = new Array();
function createBtn(images_xml) {
img_array = images_xml.firstChild.childNodes;
for (var i = 0; i<img_array.length; i++) {
var currentPic = img_array*;
var currentBorder_mc = button_mc.createEmptyMovieClip("btnBorder_mc"+i, i+10);
currentBorder_mc._x = i*btn_space;
currentBorder_mc.attachMovie("btnBorder", "btnBorder"+i, 0);
var currentBtn_mc = button_mc.createEmptyMovieClip("imgBtn_mc"+i, i);
currentBtn_mc._x = i*btn_space;
currentBtn_mc.attachMovie("btnImg", "btnImg"+i, 0);
currentBtn_mc.image = currentPic.attributes.image;
btn_array* = currentBtn_mc;
currentBtn_mc._alpha = 0;
var activebtn_mc;
currentBtn_mc.onRollOver = function() {
if (this._alpha<100) {
this._alpha += 10;
}
};
currentBtn_mc.onRollOut = function() {
if (this._alpha>0) {
this._alpha -= 10;
}
};
currentBtn_mc.onRelease = function() {
activebtn_mc._alpha = 0;
this._alpha = 100;
activebtn_mc = this;
};
currentBtn_mc.onPress = function() {
imgLoad_mc.loadMovie(this.image);
}
this.onEnterFrame = function() {
loading = imgLoad_mc.getBytesLoaded();
filesize = imgLoad_mc.getBytesTotal();
if (percent == undefined) {
percent = 0;
}
percent -= (percent-((loading/filesize)*100))*.25;
per = int(percent);
percentage = per+"%";
if (percent>99) {
delete this.onEnterFrame;
}
};
}
}
images_xml = new XML();
images_xml.ignoreWhite = true;
images_xml.onLoad = function(success) {
if (success) {
createBtn(this);
}
};
images_xml.load(“projImages.xml”);
Thanks in advance for any help with this. I have looked through the tutorials and the forums and tried various things, i just cannot seem to get any of them to work.