3 Replies Latest reply on Oct 15, 2007 3:11 AM by Greg Dove

    On keyPress Enter...

      Hi. Im a flash beginner so excuse me if this is a very obvious and simple problem. I have applied the on keyPress action to the whole of my flash document... 6 scenes worth of info (this is for a flash presentation seminar rather than a website).

      The enter key is used to pause and play the presentation. It works fine in flash put not when I publish the movie. Does anyone know why this might be?

      Thank you for your help.

      You can see the document @ http://www.rebeccapike.co.uk/RecastingSubjectivity but you need to right click and play for the thing to work.

        • 1. Re: On keyPress Enter...
          Greg Dove Level 4
          Your link didn't work for me, so I couldn't see it. But it sounds like the problem is related to focus in the browser. Flash can't receive keypress events in the browser until it has focus. It receives focus normally by a single click on the flash element or tabbing to the flash element as well I believe.

          There is a way to set focus onto the flash element when a page loads by using javascript I believe, although I've never done that. Others may be able to give you more details.
          • 2. Re: On keyPress Enter...
            rfkarchitects Level 1
            Thank you. This gives me a little bit more 'focus' at least so I know what I'm looking for. Not that it will help you but the link is http://www.rebeccapike.co.uk/RecastingSubjectivity.html

            I will do some javascript searching.

            Does anyone else know the answer? Thanks
            • 3. Re: On keyPress Enter...
              Greg Dove Level 4
              I just checked your link.... that doesn't seem to work after clicking on it either.
              The focus aspect is important if your want the keypresses to be detected by flash, but it should work after the flash element has been given focus by clicking.
              It doesn't seem to be, so there is something in your code that needs to be changed. If its working in the test movie mode and not in the browser, then it may be a timing issue between when your code runs and when something has loaded because files tend to load instantly when testing. But its difficult to tell without seeing the code.

              BTW... it seems that your swf is either very large or it loads some other large swfs. At least it takes a while on my connection for the browser to become responsive after the page begins to load the first time (firefox/windows).