3 Replies Latest reply on May 25, 2006 1:31 PM by Xetus

    setcapture, where are you?


      I need some help with the setcapture function.

      when I worked with flex 2.0 beta 2, I used it like this:
      private function mouseDown():void
      the result was simple, when my mouse was click down, all the mouse events were catched by my canvas component.

      Now in beta 3, the setcapture doesn't exist anymore for the canvas component but normaly still exists for the sprite element (i.e. the help)
      And so i tried it with the sprite element.
      But Flex seems not to know this function which is however in the help:
      "Call to a possibly undefined method setCapture through a reference with static type flash.display:Sprite."

      Would somebody have any ideas in connection with that? Or if somebody managed to compute function, it would be grantly appreciate!
        • 1. Re: setcapture, where are you?
          The Flex2 documentation on labs.adobe.com includes a migration doc for issues like this.


          Here's what it says regarding setCapture():

          The setCapture() method has been removed. This method was used to block events going to other (nested or non-nested) components during drag operations and a few other interactions. However, in the nested situation, if one component called setCapture, its parents and children could not.

          If you need this functionality, you should use the capture phase of the event model by calling stage.addEventListener("mouseXXX", mouseXXXHandler, true) where mouseXXX is the mouse event you wish to block. You can then emulate setCapture() by calling event.stopPropagation(); however, the Flex team does not recommend doing this because most components should ignore the event.
          The releaseCapture() method has also been removed.
          • 2. Re: setcapture, where are you?
            kopir Level 1
            thank you for your quick answer!
            • 3. Re: setcapture, where are you?
              I was also using the setcapture method.
              I need to receive the MOUSE_UP event when the mouse cursor is outside of the stage. But, no events occur outside of the stage, even after a call to stage.addEventListener.

              Thank you in advance.