# Delayed removeMovieClip in onEnterFrame

**URL:** https://forum.kirupa.com/t/delayed-removemovieclip-in-onenterframe/196208
**Category:** flash
**Created:** [August 6, 2006, 9:04pm UTC](https://forum.kirupa.com/t/delayed-removemovieclip-in-onenterframe/196208 "2006-08-06T21:04:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![aerahn](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@aerahn](https://forum.kirupa.com/u/aerahn)
#### Post date: [August 6, 2006, 9:04pm UTC](https://forum.kirupa.com/t/delayed-removemovieclip-in-onenterframe/196208/1 "2006-08-06T21:04:26Z")

</div>

I am trying to modify some code to include a movie clip that covers existing media controls with “grayed out” buttons if there is no media.  
The code uses an onEnterFrame to determine if there is media. What I’ve done is attach the movie w/ grayed out buttons if there is no media, and remove that movieClip if there is media.  
The issue I’m having is that there seems to be a delay when I try to remove the movie clip. Does anyone know why this is happening? Or perhaps know a better way to remove the clip more quickly? (please see code below. My modifications are in red)  
Thanks!!

//Pre-loader code  
this.onEnterFrame = function(){

//trace(this.\_x + “/” +this.y)  
//check to see if media is playing ni MediaDisplay component named “media\_container”  
mediaHolder = playerMain\_mc.presentation.media\_container; //media component

if (mediaHolder !== undefined) {  
isMedia = true;  
} else {  
isMedia = false;  
}

//Check loading percentage  
var loadPerc:Number = playerMain\_mc.currentPage\_xmlnode.attributes.loadPercentage;  
if (loadPerc == 0) {

//this.\_visible = false;  
[COLOR=red] trace(“false”);  
//Attach a movie which makes the player buttons appear grayed out if there is no media  
this.attachMovie(“coverClip\_mc”, “coverClip”, this.getNextHighestDepth());[/COLOR]  
} else {  
//Remove movie clip that makes player buttons appear grayed out

[COLOR=red]coverClip.removeMovieClip();  
[/COLOR]  
if (this.\_visible == false) {this.\_visible = true}
