10 Replies Latest reply on Dec 4, 2010 2:36 AM by Hcky

    Keypress Control for Timeline

    JLgraphicFX Level 1
      I am creating a very simple presentation in CS3, which will be projected on-screen and will have a live speaker. I would like to be able to pause the SWF at various locations along the timeline so that the speaker my discuss issues on the screen, and then presume playing it. Since don't want this control visible (such as with a button) to the audience, I would like the control either with the press of a key, such as the arrow right key, or with a remote controller. How would I encode this both with the press of a key or with a remote controller?
        • 1. Re: Keypress Control for Timeline
          rlc5611 Level 1
          Look up onKeyDown or onKeyUp in the help files. You can experiment with the controller to see what character each of its buttons returns and act accordingly.
          • 2. Re: Keypress Control for Timeline
            JLgraphicFX Level 1
            Thanks, I will. Do you know if I can use a remote control in lieu of a keyboard to make the key press?
            • 3. Re: Keypress Control for Timeline
              rlc5611 Level 1
              I know for a fact that it is possible but I have only ever tried with one particular multimedia remote (and it worked). The attached code is from the Flash help file. Experiment with the remote in test mode to see what code each button returns with. On my remote, most (but not all) of the buttons would return a unique key code to Flash. A few of the buttons were trapped by the remote's system driver so were unusable for Flash. By assigning actions to all the useful buttons, I was able to create a good navigation system rather than just go forward and backward.
              • 4. Re: Keypress Control for Timeline
                JLgraphicFX Level 1
                I'm a newbie at AS so please bear with me. I looked up the onKeyDown and onKeyUp in the Help files as you had suggested. I tried the following code but its returning an error. What am I doing wrong?
                • 5. Re: Keypress Control for Timeline
                  rlc5611 Level 1
                  If you are using CS3 and publishing for AS3 then I don't know what changes you need to make. What I posted is AS2.

                  I do see that you have a lot of errors in upper and lower case. The more recent versions of Flash are very case-sensitive.
                  • 6. Re: Keypress Control for Timeline
                    JLgraphicFX Level 1
                    I am using CS3 but publishing to AS2. How would the code be different?
                    • 7. Re: Keypress Control for Timeline
                      rlc5611 Level 1
                      I don't know how it would be different because so far I have chosen not to learn AS3. I have CS3 but I still publish to AS2.

                      You simply have a lot of mistakes in your script. I have attached your script without mistakes.

                      1) You have myListener.onKeydown ---- should be myListener.onKeyDown
                      2) You have if (Key.getcode() ---- should be if (Key.getCode()
                      3) You have ...() = Key.LEFT) { --- should be ...() == Key.LEFT) {
                      4) You have key.addListener --- should be Key.addListener

                      Your remote control may or may not return the equivalent of Key.LEFT or Key.RIGHT. You should use those traces I posted earlier to see what key codes the remote actually returns and use those key codes in your if block for navigation.

                      You can use more than one key to go left or right. For example:

                      if (Key.getCode() == Key.LEFT) {
                      prevFrame();
                      }else if (Key.getCode() == Key.RIGHT) {
                      nextFrame();
                      } else if (Key.getCode() == Key.UP) {
                      prevFrame();
                      }else if (Key.getCode() == Key.DOWN) {
                      nextFrame();
                      }
                      If you have a presentation and are using a remote, Flash will respond to BOTH the keyboard AND the remote.
                      • 8. Re: Keypress Control for Timeline
                        rlc5611 Level 1
                        I was just testing your script and the attached here works much better
                        • 9. Re: Keypress Control for Timeline
                          JLgraphicFX Level 1
                          Perfect! Thanks so much for all of your help.
                          • 10. Re: Keypress Control for Timeline
                            Hcky Level 1

                            Hi. Your post is very helpful. However, can you show  ready as3 code? I have problems with control presentation.

                            Flash Template Presentation, unfortunately, don't give full control with animations ect. :/