PDA

View Full Version : attachMovie with fade???



Inflicted
April 1st, 2004, 07:59 AM
I'm trying accomplish a fade-in for my attached
movies, using this script:

nr = 1;
tot = 8;
MovieClip.prototype.attach = function(base) {
base["content"+nr].attachMovie("mc"+nr, "clip"+nr, nr);
if (nr == tot) {
clearInterval(id);
}
nr++;
};
id = setInterval(attach, 1000, this);
MovieClip.prototype.fadein = function(base) {
for (i=1; i<5; i++) {
base["content"+i]._alpha = 0;
base["content"+i].onEnterFrame = function() {
this._alpha += 3;
if (this._alpha>=100) {
this._alpha = 100;
delete this.onEnterFrame;
}
clearInterval(mc);
};
}
};
mc = setInterval(fadein, 1000, this);

But it doesn't work. Can somebody help me out with this?

thanks
example here (http://www.inflicted.nl/example.fla.zip)

Seticus
April 1st, 2004, 10:13 AM
it works great here, could u tell us what's not working and/or what you want to achieve?

Inflicted
April 1st, 2004, 10:19 AM
Thanks Seticus,

As you can see, the fade is not working on the clips seperately, but more like on the all of them.
What I want to achieve is to have a complete fade in from 0 to 100% on all the clips on the moment of being attached.

Hope I'm clear...

Seticus
April 1st, 2004, 10:35 AM
I see, hang on...

Seticus
April 1st, 2004, 10:41 AM
nr = 1;
tot = 8;
MovieClip.prototype.attach = function(base) {
base["content"+nr].attachMovie("mc"+nr, "clip"+nr, nr);
fadein(_root);
if (nr == tot) {
clearInterval(id);
}
nr++;
};
id = setInterval(attach, 1000, this);
MovieClip.prototype.fadein = function(base) {
base["content"+nr]._alpha = 0;
base["content"+nr].onEnterFrame = function() {
this._alpha += 3;
if (this._alpha>=100) {
this._alpha = 100;
delete this.onEnterFrame;
}
};
};

Inflicted
April 1st, 2004, 10:54 AM
That's beautifull!!!

thanks a lot, Seticus!
Will examine that code for a while...

Inflicted
April 2nd, 2004, 07:36 AM
After examining that code , I wasn't too far off, for a "function" newbie...
I do recognize my mistakes, but find it hard too bring that to words right now.

One more thing: Because i want to load this movie into another, I changed this:



fadein(_root);

into:
fadein(_base);

Works like a charm!

Thanks again.