# onEnterFrame won't stop until i click?

**URL:** <https://forum.kirupa.com/t/onenterframe-wont-stop-until-i-click/290747>\
**Category:** Uncategorized\
**Created:** [June 19, 2009, 1:52am UTC](https://forum.kirupa.com/t/onenterframe-wont-stop-until-i-click/290747 "2009-06-19T01:52:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jibble](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jibble/32/2265_2.png) [@jibble](https://forum.kirupa.com/u/jibble)\
**Post date:** [June 19, 2009, 1:52am UTC](https://forum.kirupa.com/t/onenterframe-wont-stop-until-i-click/290747/1 "2009-06-19T01:52:18Z")

</div>

I have a goofy issue going on with a drag/drop scroller. When i stop dragging the following onEnterFrame will not clear/stop unless you click on the movieclip again, then it clears.

Can one of you coder minded people see anything wrong with this? It works great, but i need it to clear as it’s taking up that precious memory 😃

```auto
main2.onEnterFrame = function() {
    
    if (scrollOn) {
        mainTargetX = -(mainInitX-(main._width-Stage.width)*(main2._x-scrollbarInitX)/scrollAreaWidth);
        
    } else {
        scrollbarTargetX = -(main._x-mainInitX)*scrollAreaWidth/(main._width-Stage.width)+scrollbarInitX;
        
        if (Math.abs(main2._x-scrollbarTargetX)>0.2) {
            main2._x += -(scrollbarTargetX+main2._x)/2;
        }
    }
    if (Math.abs(main._x-mainTargetX)>0.2) {
        //this is where we calculate the blur distance
        mainOldX = main._x;
        main._x += Math.ceil((mainTargetX-main._x)/2);
        mainMovement = mainOldX-main._x;
        //we flur the blur distance for performance gains
        //(in theory, at least; this hasn't been tested)
        blur.blurY = Math.floor(Math.abs(mainMovement));
        main.filters = [blur];
        trace ("still going");
    }else{
        trace("stopped")
    }
};

```

the code is based on this scrollbar [http://oringe.com/download/blurScroll.fla](http://oringe.com/download/blurScroll.fla)
