views:

25

answers:

1

Hi guys.. I am trying to create a scroller...The videoSlider is my scrollBar and I want to drag it so my secondMC will move....everything works fine in my code but if I mouse down in my videoSlider and up outside of it....The drag state still apply and it's not what I desire....any ideas?? Thanks...

      videoSlider.addEventListener(MouseEvent.MOUSE_DOWN, scrollMC);
        videoSlider.addEventListener(MouseEvent.MOUSE_UP, stopScrollMC);



var eventTarget:Object; // to allow more global access to the dragged object

    function scrollMC(event:MouseEvent):void{
          eventTarget = Object(event.currentTarget);
          eventTarget.startDrag(false,new Rectangle(0,0,500,0));
          stage.addEventListener(MouseEvent.MOUSE_MOVE, adjust2ndX);
    }

    function stopScrollMC(event:MouseEvent):void{
          eventTarget.stopDrag();
          stage.removeEventListener(MouseEvent.MOUSE_MOVE, adjust2ndX);
    }

    function adjust2ndX(evt:MouseEvent):void {
          secondMC.x = eventTarget.x; 
    }
+3  A: 

Listen for MouseUp on the stage. Your object isn't going to get a MouseUp event if the mouseup occurs somewhere else.

ThatSteveGuy
Thanks...I got it done now...
Jerry
Agreed, this is pretty much standard practise for anything that should receive a mouseUp.
dr_tchock