Problem: AS doesn't work on a MC with an animation. Help please

Hei,
I have a MC on the stage. There is a simple animation inside this MC (a very short frame by frame animation).
Problem is that when I try to fade out this MC, it doesn’t work. I don’t access any of MC properties such as _alpha or _xscale.
I just created a new symbol convert to movie clip and in this MC made the animation with shapes. The instance name of the MC is correct.
Fading:
[AS]
aspeed=1;
_root.lines.onEnterFrame=function(){
if(this._alpha>5){
this._alpha-=aspeed;
}
else
{
this._alpha=0;
delete this.onEnterFrame;
}
}
[/AS]
Could somebody help me here?
Thanks
mx-guest2004 :slight_smile:


_root.aspeed=1;
_root.lines.onEnterFrame=function(){
	if(this._alpha>5){
	this._alpha-=_root.aspeed;
} else {
	this._alpha=0;
	delete this.onEnterFrame;
}
}

try that. In the original, I don’t think the ‘aspeed’ in the MC would have been able to reference the other ‘aspeed’. Just slap 'em both on _root

Thanks dal platinum :))
It works now. I didn’t know this. You know, my MC IS on the _root. Just want to know why I have to include a _root in my variable speed? Is this because of the animation inside MC ?

mx-guest2004

you need the _root, because you are calling it in the function, which will be run on the movieclip. You could also use _parent in this particular case.

Without the _root in the function, it will be looking for the variable ‘lines.aspeed’, which in your case will be undefined.

as items in the function are local to that mc. (or something)