This is I’m sure easy for some, but I’m retarded and need some help.
Basically I have a number of images embedded in an swf. I mearly want to fade up and fade out each image in sequence on an enterFrame function with the ability to set a delay between the up/out. They need to be embedded because I need to preload them. I previously tried this by loading them from an array but there was too much variable timing in terms of different connection speeds. There is no need to sync with the audio, but there is a need to have the duration not be factored by the users connection speed.
This is what I was using to call the images from an array.
stop();
pathToPics = “”;
pArray = [“pic1.jpg”, “pic2.jpg”, “pic3.jpg”, “pic4.jpg”];
pIndex = -1;
fadeSpeed = 1.5;
delay = 2000;
changePhoto = function () {
pIndex++;
clearInterval(myInterval);
onEnterFrame = fadeOut;
};
function fadeOut() {
if (frame_2._alpha>fadeSpeed) {
frame_2._alpha -= fadeSpeed;
} else {
//if there is a next picture, load it
if (pIndex<pArray.length) {
loadPhoto();
} else {
//set the last picture _alpha 0 and delete the onEnterframe
frame_2._alpha = 0;
onEnterFrame = null;
myInterval = setInterval(delay);
nextFrame();
}
}
}
function loadPhoto() {
var p = frame_2;
p._alpha = 0;
p.loadMovie(pathToPics+pArray[pIndex]);
onEnterFrame = loadMeter;
}
function loadMeter() {
var i, l, t;
l = frame_2.getBytesLoaded();
t = frame_2.getBytesTotal();
if (t>0 && t == l) {
onEnterFrame = fadeIn;
} else {
trace(l/t);
}
}
function fadeIn() {
if (frame_2._alpha<99-fadeSpeed) {
frame_2._alpha += fadeSpeed;
} else {
frame_2._alpha = 99;
//removed the if statement here
myInterval = setInterval(changePhoto, delay);
onEnterFrame = null;
}
}
myInterval = setInterval(changePhoto, delay);