4 Replies Latest reply on Sep 22, 2009 10:17 PM by theoriginaldrizz

    onPress event Issue - have to roll off a movieClip for it to respond again

    theoriginaldrizz

      I have a scrollBar movieClip inside an interface that is not always responding to the onPress event. Sometimes, it works fine, and sometimes I have to roll off of the scrollBarMC for the cursor to change back to the finger and respond to the onPress event.

      Other times, it responds more than once to the event on just one click.

       

      I realize that there could be other issues within my interface's code, however, when I trace my function calls they seems to not execute or execute more than once. Has anyone else ever run across such an issue with the  movieClip.onPress event?

       

      Below is the code for the scrollBar mc. Anyone see something glaring?

       

      TIA,

       

      -Andy

       

       

      scrollBar.scroller.onPress = function():Void  {
        dist = this._parent._xmouse-this._x;
        this.onMouseMove = function():Void  {
         tmp = 1+Math.ceil(((this._parent._xmouse-dist)-scrollBarStart)/(scrollBar._width-scrollBarStop) *(infostruc.length-1));
         if (tmp>infostruc.length) {
          tmp = infostruc.length;
         }
         if (tmp<1) {
          tmp = 1;
         }
         current = tmp;
         updateInfo();
        }
      };


      scrollBar.scroller.onRelease = scrollBar.scroller.onReleaseOutside=function ():Void {
        trace("scrollBar.scroller.onRelease");
        stopDrag();
        delete this.onMouseMove;
      };


      scrollBar.left.onPress = function():Void  {
        trace("press left");
        previous();
        shifter = setInterval(previous, scrollerDelay);
      };


      scrollBar.right.onPress = function():Void  {
        trace("press right");
        next();
        shifter = setInterval(next, scrollerDelay);
      };


      scrollBar.onMouseUp = function():Void  {
        clearInterval(shifter);
      };


      scrollBar.onMouseDown = function():Void  {
        if (this.hitTest(_xmouse, _ymouse, true) && !this.left.hitTest(_xmouse, _ymouse, true) && !this.right.hitTest(_xmouse, _ymouse, true)) {
         if (this._xmouse<this.scroller._x) {
          previous();
          shifter = setInterval(previous, clickDelay);
         }
         if (this._xmouse>this.scroller._x+this.scroller._width) {
          next();
          shifter = setInterval(next, clickDelay);
         }
        }
      };