4 Replies Latest reply on Apr 2, 2007 5:05 PM by abeall

    right click?

    DZ-015 Level 1
      Hey. Is there a way to define right click actions? When you right click on a swf that is active, the normal action flash takes is to bring up the Flash Settings menu. Is there a way I can:
      A - tell flash not to do that.
      B - define my own actions to take?

      for instance... if I wanted to bring up a little menu on a movie clip when the user right clicks on it...

      any advice? or am I asking for the impossible?
        • 1. Re: right click?
          abeall Level 3
          You can't completely take the context menu away, but you can take most of the actions away using Stage.showMenu = false, or you can take specific ones away as well al add your own using the ContextMenu class.
          • 2. right click?
            DZ-015 Level 1
            So - another scenario...

            Let's say I wanted to build a classic RTS game (like Warcraft) in flash. The typical user interface there is left click to select a unit, right click where you want the unit to go.

            Is there any way to simply disable Context Menus so I could attempt this?

            For instance - I know it would be painful... but could you wrap the swf file in another kind of element (javascript or something) that would accept mouse commands and relay them to the swf file in a way it could accept?

            • 3. Re: right click?
              kglad Adobe Community Professional & MVP
              you can use javascript to detect a right click and communicate that to flash (using the externalinterface class).

              but like most code in javascript, you'll need to code differently for various browsers and browser versions.
              • 4. Re: right click?
                abeall Level 3
                > Is there any way to simply disable Context Menus so I could attempt this?
                Not in a browser, it's simply not possible to remove the menu completely from the Flash Player. As kglad said, you could capture right-click events using JavaScript, but the menu would still appear.

                However, if you create a Projector file(.exe, .hqx) you can use third party projector software, such as Zinc or SWF Studio to completely remove it -- but then it cannot play in a web browsers, obviously, it must be downloaded as a program and run locally, which people are vastly more hesitant to do, as the program could easily be a virus or such.

                I made an RTS engine once, I opted for Ctrl+Click instead of right-click for secondary actions.