Douglas,

The method Michael is talking about should work fine for you. Although the 
listener is on the whole app, the function called is still scoped to your 
component.  
                You really don't want to use the mouseOff event to stop 
dragging, as users will find that annoying to no end.  
                Here's an example component that should make it a little more 
clear.

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"; 
horizontalScrollPolicy="off" verticalScrollPolicy="off">
    <mx:Script>
        <![CDATA[

             private function mouseDownHandler(event:MouseEvent):void {
                 button.startDrag(false, new 
Rectangle(rule.x,rule.y+rule.height/2-button.height/2, rule.width-button.width, 
0));
                 systemManager.addEventListener(MouseEvent.MOUSE_UP, 
mouseUpHandler, false, 0, true);
             }

             private function mouseUpHandler(event:MouseEvent):void {
                 systemManager.removeEventListener(MouseEvent.MOUSE_UP, 
mouseUpHandler, false);
                 button.stopDrag();
             }

        ]]>
    </mx:Script>
    <mx:HRule id="rule" left="0" right="0" height="3" verticalCenter="0" />
    <mx:RadioButton id="button" selected="true" 
mouseDown="mouseDownHandler(event)" 
top="{rule.y+rule.height/2-button.height/2}" height="13" width="13" />
</mx:Canvas>

Ben Stucki 

                                -------------------------------

We're Hiring! Seeking a passionate developer to join our team building Flex

based products. Position is in the Washington D.C. metro area. If interested

contact [EMAIL PROTECTED]

----------------------------------------

                                From: "Douglas Knudsen" <[EMAIL PROTECTED]>
Sent: Monday, February 05, 2007 12:18 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] MouseUpSomewhere event, whence hast thou gone? 

that adds a mouseUp listener/handler for the whole app, eh?  How do I know if 
this mouseUp is related to the object the user gestured a mouseDown on?  Kind 
of coupled up too.

What I have is this screen snap

http://www.cubicleman.com/snaps/snap.png
I have mouseDown capture on the bluish color box that allows me to drag it 
left/right and to shrink/expand the length of it while holding the mouse button 
down on it.  Now, if the user is holding the mouse button down and accidentally 
moves the mouse off of the bluish box and then lets the mouse button go, I want 
to fire a event then that executes a method inside the component representing 
the bluish box.  

Starting to think maybe just fire the mouseOut event and ignore this possible 
user accident!  

DK

On 2/5/07, Michael Schmalle <[EMAIL PROTECTED]> wrote:

Hi,

try adding a listener to the systemManager; IE

systemManager.addEventListener(MouseEvent.MOUSE_UP, 
systemManager_mouseUpHandler);

Peace, Mike

On 2/5/07, 
Douglas Knudsen <[EMAIL PROTECTED]> wrote:

I'm converting a Flex 1.5 app to 2.0.  Under 1.5 I used a event on a HBox 
called MouseUpSomewhere.  Seems this is no more in 2.0.  Any ideas what it is 
now called?  Or maybe another way to get this same functionality to work?  I 
can't use mouseOut.  I need a event that fires when the user releases the mouse 
button whilst over a different component.

-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?

-- 
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

-- 
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?

                                                


Reply via email to