I am having a problem with this code and I believe it is because the intervals are not being cleared and all the functions are running through over and over. I am not sure how to fix this as this code is a bit beyond what I would have come up with on my own (this was built from an example provided by Stringy) and also worked…exactly as it is… in the past.
The problem began when I moved from Flash MX 2004 Professional to Flash 8. As long as it is saved and exported (or published) as a Flash MX 2004 file, the code works. Save it as a Flash 8 file and it does not. Unfortunately, I saved the only file I have in 8 format before discovering this.
Actionscript 2.0 was introduced with MX 2004, (correct?) so this should not have anything to do with the problem…
//sets up mc holders and fades pics in and out
var i = 1;
function loadIn(movie, x, y) {
**clearInterval(arguments.callee["Interval"+i]);** clip = _root.createEmptyMovieClip("holder"+i, i+20);
clip._x = x;
clip._y = y;
clip.loadMovie(movie);
clip._alpha = 0;
_root["temp"+i] = _root.createEmptyMovieClip("tmp"+i, i+10);
_root["temp"+i].obj = clip;
_root["temp"+i].onEnterFrame = preloadf;
i++;
}
function preloadf() {
var e = this.obj.getBytesLoaded();
var f = this.obj.getBytesTotal();
if (f == e && f>4) {
this.onEnterFrame = fadein;
}
}
function fadein() {
this.obj._alpha += 4;
if (this.obj._alpha>=100) {
this.onEnterFrame = fadeout;
}
}
function fadeout() {
this.obj._alpha -= 2;
if (this.obj._alpha<=0) {
this.obj._alpha = 0;
delete this.onEnterFrame;
}
}
loadin.Interval1 = setInterval(loadIn, 1050, "intro1.jpg", 555, 112);
loadin.Interval2 = setInterval(loadIn, 2050, "intro2.jpg", 191, 112);
loadin.Interval3 = setInterval(loadIn, 3050, "intro3.jpg", 0, 112);