Flash Actionscript Button emulates Keystroke

Posted on 2009-12-30
Last Modified: 2013-11-11
I need to create a Flash button that when onClick it emulates the Windows-M shortcut.  I cannot seem to find the correct way to do this in AS3?  Can somebody post either the code to do this or a tutorial?  Everything I have found is on listening for keystrokes which is not what I need.

Question by:pda4me
    LVL 19

    Expert Comment

    windows-m to minimize all windows?  you can't do that with flash.  if you used a combination of AIR (or a Projecter) and VBS, you could do it, but it'd have to be client-side only (not deployed online).

    Author Comment

    Yes, the intent is to export to a windows projecter (.exe).
    LVL 19

    Accepted Solution

    * you shouldn't need to use both the bat and the vbscript, but in quick testing using only the vbscript failed, so just use the combination provided below for now - maybe you can tweak it to work with just one additional file instead of two later *

    ok, add this listener to your button:

    yourButtonInstanceName.addEventListener("click", minimizeAll, false, 0, true);

    function minimizeAll(event:Event):void{

    in the same folder as your projector, create a folder called "fscommand" - it has to be that exactly, fscommand methods look there for application files

    in the folder called fscommand, create two files:

    in miminize-all.bat, put one line that says "minimize-all.vbs" - without the quotes.  close and save.

    the contents of minimize-all.vbs is also just one line:


    that's it.

    *it won't work using Test Movie * you need to publish it as a projector file, and run the projector executable.

    Author Closing Comment


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now