MX: Confused about gotoAndPlay()-ing nested MCs

It’s me again! I mean- Hi ^^

This is a somewhat complicated task, I guess.

I wrote a function (resting on the main timeline, “Actions” level) that fades any MC, in or out, according to input values. It works great when it is called from within the Actions layer it’s on:

function fade(what,how,towhere) {
if (how == “in”) { // (Alpha +)
this.onEnterFrame = function() {
if ((what._alpha+20)<=towhere) {
what._alpha += 20;
} else {
what._alpha = towhere;
delete this.onEnterFrame;
}
};
} else { // (Alpha -)
this.onEnterFrame = function() {
if ((what._alpha-20)>=towhere) {
what._alpha -= 20;
} else {
what._alpha = towhere;
delete this.onEnterFrame;
}
};
}
}
I’m actually almost a bit proud of it.

I have a “timed” function (using a counter together with the “onEnterFrame” event), also on the main timeline, that displays an MC… wich also works nicely.

Only that this MC, on the last frame, uses the above fading function on itself (phrasing: >> _root.fade(this,“out”,“0”); <<) and once it’s fully faded away, the timed loop on the main timeline stops… which it’s not supposed to.

Could that be because of the “delete this.onEnterFrame” in it? I disabled that part and the error still occurs. Any ideas or workarounds? I guess it might be because my referencing between timelines is greatly lacking style…? or am I using “this” too much? I don’t know how else to do it :frowning: The main timeline only has one frame, btw.

Please help a frustrated Flashaholic-wannabe ^^