A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: stopDrag?

  1. #1
    Senior Member
    Join Date
    May 2001
    Location
    Kansas City
    Posts
    198

    stopDrag?

    here's the deal. i have a nav menu inside an mc. in the nav, i want something to follow the mouse. right now, i have a box that basically hovers over the nav choices. makeing an invisible button inside the nav mc, i can use startDrag on rollover to get the slider moving. unfortunately once that happens, it never leaves the mouse alone. it still stays within the bounds of the rectangle i defined (the nav mc), but i cannot get it to stop when i rollout. how can i get this? is there a better way? i know i've seen this done before, and think i've even seen a tutorial on it, but can't find it now.

  2. #2
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236
    Assuming the navigation instance name is "nav" and the slider's is "slide".

    Attach this code to slide:

    Code:
    onClipEvent (mouseMove) {
    	if (hitTest(_root._xmouse, _root._ymouse, false)) {
    	} else {
                 this.stopDrag();
            }
    }
    Your startDrag event will confine it to the nav area and when you mouse out of it, the slide cannot follow the mouse and the hitTest will become false, thus stopping the drag. Another way you could do it would be to capture the mouse's coordinates. _root._ymouse and _root._xmouse and compare them to the nav's coordinates. Once the mouse left the bounds you could trigger the stopDrag.
    Thanks,
    John Z.

  3. #3
    Senior Member
    Join Date
    May 2001
    Location
    Kansas City
    Posts
    198
    that is perfect. thank you.

  4. #4
    Restarting from Scratch
    Join Date
    Feb 2001
    Location
    Sacramento, CA
    Posts
    236
    Glad to help!
    Thanks,
    John Z.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center