# Poor frame rate

**URL:** <https://forum.kirupa.com/t/poor-frame-rate/95315>\
**Category:** Uncategorized\
**Created:** [November 24, 2003, 1:52am UTC](https://forum.kirupa.com/t/poor-frame-rate/95315 "2003-11-24T01:52:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brusca](https://avatars.discourse-cdn.com/v4/letter/b/47e85d/32.png) [@Brusca](https://forum.kirupa.com/u/Brusca)\
**Post date:** [November 24, 2003, 1:52am UTC](https://forum.kirupa.com/t/poor-frame-rate/95315/1 "2003-11-24T01:52:34Z")

</div>

Hi guys,  
I have an “onEnterFrame()” function in one of my movieclips which calculates my mouse position and sets off some script according to the position.

Unfortunately this code is slowing my movies frame rate from 30 to about 15 and I am unsure of how I can recode this so it won’t slow down the movie.

Basically I have a rectangular movie clip that slides from left to right depending on the users \_xmouse. But I only want it to execute while the mouse is over that particular movie clip.

Here is my code below. The rectangular movie sits at the bottom of my stage so all I am doing is working out if the \_ymouse is below the \_y of the movie…if so the code executes.

I am sure there is a better way to do this. But not sure how.

this.onEnterFrame = function(){  
mse = \_xmouse; // get \_xmouse

if(\_parent.\_ymouse \> \_parent.eventSlide.\_y){

//if \_ymouse is below movie clip  
if(mse\>378){  
if(events.\_x\<=evntwdt)  
events.\_x = evntwdt;  
}else{  
events.\_x = events.\_x + 5;  
}  
if(mse\<378){  
if(events.\_x\>=0)  
events.\_x = 0;  
}else{  
events.\_x = events.\_x - 5;  
}  
}  
}

Cheers
