A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: "HOW TO" attach an action script to the "ESC" key

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    30

    Post

    We're trying to attach an action script to the "ESC" key.
    We're trying to accomplish an exit from the movie, from within any scene/frame at any time.
    We want the application/movie to shut down and quit completely whenever the "ESC" key is pressed, we want to bypass going into the 'flashplayer' and just shutdown.
    Thanks in advance for everyones help.
    The B's.

  2. #2
    Lifetime Friend of Site Staff Northcode's Avatar
    Join Date
    Dec 2000
    Location
    Whitehorse YT
    Posts
    3,766

    Couldn't you use a movieclip on the main timeline with an onClipEvent watching for KeyUp and just check the keycode for an ESC and then call fscommand("quit") when you see the ESC key? You'd need to use fscommand("trapallkeys", "true") to catch the escape key though.

    If that doesn't cut it, someone else may have a solution that works. I'm okay with the ActionScript (hey, it's just code) it's the Flash stuff I haven't mastered yet

    You can also do this in SWF Studio (www.northcode.com) without any scripting, just use the the "exit on ESC" checkbox (enabled by default).


  3. #3
    Junior Member
    Join Date
    Dec 2000
    Posts
    10
    I usually do this with a button. Make an invisible button and put it on a layer of the main timeline that is present during all the time you want the Escape to be available. Then set the button to keystroke <escape> and use fscommand "quit". It works on both Mac and Windows projectors.

  4. #4
    *********** Jugglor does this automatically also

    http://www.jugglor.com

    Download an free evaluation copy and try it for yourself.


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