# How to toggle functionality

**URL:** <https://forum.kirupa.com/t/how-to-toggle-functionality/220026>\
**Category:** flash\
**Created:** [March 22, 2007, 12:15am UTC](https://forum.kirupa.com/t/how-to-toggle-functionality/220026 "2007-03-22T00:15:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsj4](https://avatars.discourse-cdn.com/v4/letter/t/7ea924/32.png) [@tsj4](https://forum.kirupa.com/u/tsj4)\
**Post date:** [March 22, 2007, 12:15am UTC](https://forum.kirupa.com/t/how-to-toggle-functionality/220026/1 "2007-03-22T00:15:00Z")

</div>

Got some code tht allows me to horizontally scroll some thumbnails depending on where my mouse is in relation to a mc named stroke. I need to be able to disable the functionality if I am not over my panel that gets scrolled.

Here is my code.

```auto
///////////////////////////////////////
///// Panel Scroller
///////////////////////////////////////
panel.onRollOver = panelOver1;
function panelOver1() {
    this.onEnterFrame = scrollPanel1;
    delete this.onRollOver;
    updateAfterEvent();
}
var b = stroke.getBounds(_root);
 
function scrollPanel1() {
    if (_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {
        this.onRollOver = panelOver1;
        delete this.onEnterFrame;
        updateAfterEvent();
    }
    if (panel._x>=200) {
        panel._x = 200;
    }
    if (panel._x<=-306) {
        panel._x = -306;
    }
    var xdist = _xmouse-416;
    panel._x += -xdist/12;
}

```
