8 Replies Latest reply on Jul 15, 2010 6:46 AM by toastiesmonster

    Question about keyboard control in Flash presentation

    toastiesmonster Level 1

      I created a presentation in Flash. And I embedded the following keyboard control scripts so that I can pause the slide by pressing "Spacebar" and play it again by pressing "Enter".

       

      keyListener = new Object();
      var isStopped : Boolean = false;


      keyListener.onKeyUp = function() {
          var keyCode = Key.getCode();
         
          if (keyCode == 13) {
             _root.play();
               }
      if (keyCode == 32) {
             _root.stop();
               }
      };
      Key.addListener(keyListener);

       

      I also embedded getTimer script to delay the speed of the flow so that key-point can be loaded one by one.

       

      stop();
      t = getTimer();
      onEnterFrame = function(){
          if(getTimer()>= t+3000){
              play();
              onEnterFrame = undefined;
          }
      }

       

      Other than the above keyboard control, I also add four buttons at the right bottom so that I can play and pause, fast forward and rewind by clicking those four buttons.


      Problems:
      1. the 1st and 2nd slide cannot be paused by the above keyboard control command.


      2. the play and pause buttons at the right bottom is not functional in the 1st and 2nd slide

       

      (i attached the fla for easier understanding of the above descriptions. appreciated if you can help me to figure out what goes wrong.

      http://www.beyondmusic.net/AdBanner/rm_dummy.zip