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

**URL:** <https://forum.kirupa.com/t/problem-as-doesnt-work-on-a-mc-with-an-animation-help-please/118164>\
**Category:** Uncategorized\
**Created:** [August 3, 2004, 9:35am UTC](https://forum.kirupa.com/t/problem-as-doesnt-work-on-a-mc-with-an-animation-help-please/118164 "2004-08-03T09:35:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mx\_guest2004](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@mx\_guest2004](https://forum.kirupa.com/u/mx_guest2004)\
**Post date:** [August 3, 2004, 9:35am UTC](https://forum.kirupa.com/t/problem-as-doesnt-work-on-a-mc-with-an-animation-help-please/118164/1 "2004-08-03T09:35:01Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![dal\_platinum](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dal\_platinum](https://forum.kirupa.com/u/dal_platinum)\
**Post date:** [August 3, 2004, 9:46am UTC](https://forum.kirupa.com/t/problem-as-doesnt-work-on-a-mc-with-an-animation-help-please/118164/2 "2004-08-03T09:46:41Z")

</div>

```auto

_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

---

<div class="post-metadata">

**Author:** ![mx\_guest2004](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@mx\_guest2004](https://forum.kirupa.com/u/mx_guest2004)\
**Post date:** [August 3, 2004, 9:57am UTC](https://forum.kirupa.com/t/problem-as-doesnt-work-on-a-mc-with-an-animation-help-please/118164/3 "2004-08-03T09:57:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dal\_platinum](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@dal\_platinum](https://forum.kirupa.com/u/dal_platinum)\
**Post date:** [August 3, 2004, 1:59pm UTC](https://forum.kirupa.com/t/problem-as-doesnt-work-on-a-mc-with-an-animation-help-please/118164/4 "2004-08-03T13:59:35Z")

</div>

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)
