• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

Flash Actionscript Button emulates Keystroke

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.

Thanks!
0
pda4me
Asked:
pda4me
  • 2
  • 2
1 Solution
 
moagriusCommented:
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).
0
 
pda4meAuthor Commented:
Yes, the intent is to export to a windows projecter (.exe).
0
 
moagriusCommented:
* 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{
      fscommand("exec","minimize-all.bat");
}

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:
minimize-all.bat
minimize-all.vbs

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:

wscript.createobject("shell.application").minimizeall

that's it.

*it won't work using Test Movie * you need to publish it as a projector file, and run the projector executable.
0
 
pda4meAuthor Commented:
Thanks!
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now