I am having a issue with one of my flash pieces. Pretty much because I suck at math.
My fla is setup with 4 movie holders each has an array being passed into them to attach the corresponding movie.
Right now I have it setup so all 4 movieclips change every 5 seconds. What I need is to have all 4 load at the same time and then after that I need one image to change then the next image to change and so on.
I’m sure this code is really inefficient but I needed it done quickly.
// ===================================================================
// DEFINE DELAYS
// ===================================================================
firstDelay = 5000;
secondDelay = 5000;
thirdDelay = 5000;
fourthDelay = 5000;
// ===================================================================
// ===================================================================
// COUNTER DEFINITION AND ARRARY FOR FIRST HOLDER
// ===================================================================
a = 0;
firstHolder = new Array();
firstHolder[0] = "pic1_mc";
firstHolder[1] = "pic2_mc";
firstHolder[2] = "pic3_mc";
firstTotal = firstHolder.length;
// ===================================================================
// ===================================================================
// COUNTER DEFINITION AND ARRAY FOR SECOND HOLDER
// ===================================================================
b = 0;
secondHolder = new Array();
secondHolder[0] = "pic4_mc";
secondHolder[1] = "pic5_mc";
secondHolder[2] = "pic6_mc";
secondTotal = secondHolder.length;
// ===================================================================
// ===================================================================
// COUNTER DEFINITION AND ARRAY FOR THIRD HOLDER
// ===================================================================
c = 0;
thirdHolder = new Array();
thirdHolder[0] = "pic7_mc";
thirdHolder[1] = "pic8_mc";
thirdHolder[2] = "pic9_mc";
thirdTotal = thirdHolder.length;
// ===================================================================
// ===================================================================
// COUNTER DEFINITION AND ARRAY FOR FOURTH HOLDER
// ===================================================================
d = 0;
fourthHolder = new Array();
fourthHolder[0] = "pic10_mc";
fourthHolder[1] = "pic11_mc";
fourthHolder[2] = "pic12_mc";
fourthTotal = fourthHolder.length;
// ===================================================================
// ===================================================================
// INITIAL IMAGE LOAD TO ALL HOLDERS
// ===================================================================
firstInitialImage();
secondInitialImage();
thirdInitialImage();
fourthInitialImage();
// ===================================================================
// ===================================================================
// START INDIVIDUAL SLIDSHOWS
// ===================================================================
slideshow1();
slideshow2();
slideshow3();
slideshow4();
// ===================================================================
// ===================================================================
// FUNCTIONS
// ===================================================================
function firstNextImage() {
if (a<(firstTotal-1)) {
a++;
if (loaded == filesize) {
holder1_mc.attachMovie(firstHolder[a], firstHolder+a, this.getNextHighestDepth());
slideshow1();
}
}
}
function secondNextImage() {
if (b<(secondTotal-1)) {
b++;
if (loaded == filesize) {
holder2_mc.attachMovie(secondHolder**, secondHolder+b, this.getNextHighestDepth());
slideshow2();
}
}
}
function thirdNextImage() {
if (c<(thirdTotal-1)) {
c++;
if (loaded == filesize) {
holder3_mc.attachMovie(thirdHolder[c], thirdHolder+c, this.getNextHighestDepth());
slideshow3();
}
}
}
function fourthNextImage() {
if (d<(fourthTotal-1)) {
d++;
if (loaded == filesize) {
holder4_mc.attachMovie(fourthHolder[d], fourthHolder+d, this.getNextHighestDepth());
slideshow4();
}
}
}
function slideshow1() {
firstInterval = setInterval(firstPauseSlideShow, firstDelay);
}
function slideshow2() {
secondInterval = setInterval(secondPauseSlideShow, secondDelay);
}
function slideshow3() {
thirdInterval = setInterval(thirdPauseSlideShow, thirdDelay);
}
function slideshow4() {
fourthInterval = setInterval(fourthPauseSlideShow, fourthDelay);
}
function firstPauseSlideShow() {
clearInterval(firstInterval);
if (a == 2) {
a = 0;
firstInitialImage();
} else {
firstNextImage();
}
}
function secondPauseSlideShow() {
clearInterval(secondInterval);
if (b == 2) {
b = 0;
secondInitialImage();
} else {
secondNextImage();
}
}
function thirdPauseSlideShow() {
clearInterval(thirdInterval);
if (c == 2) {
c = 0;
thirdInitialImage();
} else {
thirdNextImage();
}
}
function fourthPauseSlideShow() {
clearInterval(fourthInterval);
if (d == 2) {
d = 0;
fourthInitialImage();
} else {
fourthNextImage();
}
}
function firstInitialImage() {
if (loaded == filesize) {
holder1_mc.attachMovie(firstHolder[0], firstHolder+a, this.getNextHighestDepth());
slideshow1();
}
}
function secondInitialImage() {
if (loaded == filesize) {
holder2_mc.attachMovie(secondHolder[0], secondHolder+b, this.getNextHighestDepth());
slideshow2();
}
}
function thirdInitialImage() {
if (loaded == filesize) {
holder3_mc.attachMovie(thirdHolder[0], thirdHolder+c, this.getNextHighestDepth());
slideshow3();
}
}
function fourthInitialImage() {
if (loaded == filesize) {
holder4_mc.attachMovie(fourthHolder[0], fourthHolder+d, this.getNextHighestDepth());
slideshow4();
}
}
// ===================================================================