Scrolling panorama

I have a panoramic image that scrolls left and right depending on if the cursor is left or right of center.

I’ve placed a button inside this scrolling panel and given it an instance name of b1. I want that button to stop the scrolling on rollOver, and restart the scrolling on rollOut.

Although I understand the theory of what I need to do, I’m totally lost when it comes to actually applying it to the code I already have, and my attempts so far only kill the scrolling effect entirely.

Can someone please show me how to code my button correctly?

The current code in my first frame is like this:

stop();  
 
panel.onRollOver = panelOver;  
 
function panelOver () {  
   this.onEnterFrame = scrollPanel;  
   delete this.onRollOver;  
}  
 
var b = stroke.getBounds(_root);  
 
function scrollPanel () {  
   if (_xmouse<b.xMin || _xmouse>b.xMax || _ymouse<b.yMin || _ymouse>b.yMax) {  
      this.onRollOver = panelOver;  
      delete this.onEnterFrame;  
     }  
      
     if(panel._x >= 0) {  
         panel._x = 0;  
           
       }  
           
     if(panel._x <= -6390) {  
         panel._x = -6390;  
        
       }  
      var xdist = _xmouse - 400;  
        
        
      panel._x += -xdist / 75;  
}