Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1093213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:47:45+00:00 2026-05-16T23:47:45+00:00

i’ve created a simple panel with a title bar, and i’m trying to share

  • 0

i’ve created a simple panel with a title bar, and i’m trying to share the title bar between MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_CLICK and MouseEvent.DOUBLE_CLICK. oh mouse down, the panel is draggable, on mouse click the panel collapses and expands, and on mouse double click the panel is hidden.

i’m struggling to make these all work with the same title bar sprite of the panel. mouse down activates a click when the mouse is up, etc. is it possible to have these mouse events distinguishable on the same object?


i forgot to mention that i’m programming an AIR application, so while i believe PatrickS’s solution below would work for a regular .swf file or one that has custom drag and drop functions, i don’t really have access to the nativeWindow’s startMove() function. however, i’ve managed to share the panel’s titleBar object between MOUSE_DOWN and MOUSE_CLICK events by polling for the position of the nativeWindow.

private function titleBarMouseDownEventHandler(evt:MouseEvent):void
    {
    windowCoords = new Point(stage.nativeWindow.x, stage.nativeWindow.y);
    stage.nativeWindow.startMove();
    }

private function titleBarClickEventHandler(evt:MouseEvent):void
    {
    if  (stage.nativeWindow.x != windowCoords.x && stage.nativeWindow.y != windowCoords.y)
        return;

    //expand & collapse code
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:47:45+00:00Added an answer on May 16, 2026 at 11:47 pm

    yes you can check the event type and add a conditional for your function to execute

    
    private function mouseEventHandler(event:MouseEvent):void
    {
        switch( event.type )
        {
             case MouseEvent.MOUSE_DOWN:
                   dragClip();
                   break;
    
             case MouseEvent.CLICK:
                   removeListeners();
                   clickHandler();
                   break;
         }
    
    }
    
    private function dragClip():void
    {
       //remove listeners while you're dragging
       //add them back on mouse up
       removeListeners(); 
    }
    
    private function clickHandler():void
    { 
         //do what you need
         //then re-add the event listeners when the action is done
         addListeners();
    }
    

    if you still can’t distinguish using this method, you may have to create a second handler for the conflicting functions… come to think of it , you could also consider disabling other mouse event handlers when one is active… just a thought

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.