A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: After end of MouseMove or drag event menu keeping from release menu items

  1. #1
    Junior Member
    Join Date
    Jul 2016
    Posts
    5

    After end of MouseMove or drag event menu keeping from release menu items

    I try to make a simple game. Users can add any object from slider list by tapping. Slider list menu is larger than screen size. So user can drag the menu lefto right or vice versa. Slider menu list is ok. But after siliding (move event) with lifting finger on the screen without choosing a button that dermined by depending on the finger on which button works. I am having a problem with draggable menu including menu button items. At the end of drag operation (when I lift my finger from the screen) a button sub item works because of its MOUSE_UP code.

    I need drag end drop my menu. After drop menu button items listeners should start for release (MOUSE_UP). How can I separete them?

    I read some similar messages but I couldnt solve my problem.

    Sory for my poor English.

    My code:
    PHP Code:
    addEventListener(MouseEvent.MOUSE_MOVEdragStart); 
    addEventListener(MouseEvent.MOUSE_UPdragStop); 
    function 
    dragStart(e:MouseEvent):void {
        
    e.currentTarget.startDrag(false,new Rectangle(0,0,500,0)); 
    }
    function 
    dragStop(e:MouseEvent):void 
        
    e.currentTarget.stopDrag(false,new Rectangle(0,0,500,0)); 


  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    921
    addEventListener has more than 2 params, you can use 'useCapture' and / or 'priority' to control the order that event listeners are called in. also there are stopPropagation and stopImmediatePropagation in events that can block other listeners from being called (e g if you dont want to trigger the button after you dropped it).
    who is this? a word of friendly advice: FFS stop using AS2

  3. #3
    Junior Member
    Join Date
    Jul 2016
    Posts
    5
    Thanks realMakc,
    How can I use your advise in this sample file?

    http://1e1ders.net/SliderButtons.rar

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,785
    Hi,

    If you publish your movie for AIR 3.4 for Android instead of AIR 3.2 for Android as you have, you will be able to use MouseEvent.RELEASE_OUTSIDE

    PHP Code:
    addEventListener(MouseEvent.MOUSE_DOWN,dragStart);

    addEventListener(MouseEvent.MOUSE_UPdragStop);

    addEventListener(MouseEvent.RELEASE_OUTSIDE ,dragStop);

    function 
    dragStart(e:MouseEvent):void
    {
        
    e.currentTarget.startDrag(false,new Rectangle(0,0,500,0));
    }

    function 
    dragStop(e:MouseEvent):void
    {
        
    stopDrag();


Tags for this Thread

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