2 Replies Latest reply on Jan 23, 2007 6:23 AM by Applied CD

    detect scape key

    Level 7
      I need to detect if the Scape key was pressed and then go to another frame.
      Can you tell me please, how to do it?
      thank you

        • 1. Re: detect scape key
          Level 7
          I assume you mean the Escape key, not the Scape key? If so, then
          something like this should work:

          on KeyDown me
          if (the key = ESC) then
          go to frame("X")
          end if
          • 2. Re: detect scape key
            Applied CD Level 1
            I’m just gonna add my $0.02 You’ve got to be careful on Windows with the ESC key as it will normally close the projector and terminate your program. To prevent the ESC from shutting down your program you need the following:

            _movie.exitLock = TRUE

            (this can also be set in the publish settings)

            Once that’s done it’s up to you to provide the user with a way to exit your program, the usual methods will ALL be disabled (including the X in the window title bar). Fortunately, Director has a convenient (but undocumented as far as I can tell) handler, on closeRequest that can be placed in a movie script. This handler can contain code that overrides a normal close event, such as directing the users to an end credits screen before actually exiting the program.