2 Replies Latest reply on Jun 7, 2009 5:41 PM by shintashi

    resolving keylistener vs. onEnterframe?

    shintashi Level 1

      The below program responds to the keylisteners, but doesn't respond to the onEnterFrame.

       

      -------------

       

      keyListener = new Object();

       


      keyListener.onKeyDown=function(){

       

       

       

         var keyUsed = Key.getCode();

       

      //a
         if (keyUsed == 65){
      block_mc._rotation = 30;
             }else if (keyUsed == 66){
      block_mc._rotation = 60;
             }
      onEnterFrame = function(){
          block_mc._rotation = 90;
      }
      }
      Key.addListener(keyListener);
         
          //if keys aren't pressed this becomes default
      onEnterFrame = function(){
          block_mc._rotation = 90;
      }

       

      ---------

       

      In another program, I have a series of arrow key commands that start sequences inside an onEnterFrame,

      and they continue until terminated by an "else{... set all values to zero/neutral}"

      When this version is in play, arrow key commands have no power to over ride the onEnterFrame's "else".

       

       

      So basically, I can have keylisteners, or onEnterFrame stuff working on the same object (such as block_mc),

      but I haven't figured out how to make it so when a keylistener (like abcdefg) is activated, it works AND when a standard

      arrow key/space/shift is pressed, it also works.

       

      They seem to be completely incompatable codes.