10 Replies Latest reply on May 5, 2010 9:35 PM by c0j

    detect a keyboard press in flash.. help!

    pagsarmingan

      This is my code..

      An error appears :Incorrect Number of arguments Expected 1       Source:  detectKey();

       

      can anyone help me whats missing in my code tnx:

       

      stop();

       

      loaderInfo.addEventListener(ProgressEvent.PROGRESS,updateloader);

      stage.addEventListener(KeyboardEvent.KEY_DOWN, detectKey);

       

      function detectKey(event:KeyboardEvent):void {

       

         if(event.keyCode==13){

          gotoAndStop("contact");

           }

      }

       

      function updateloader(e:ProgressEvent){

      var percentloaded:Number=Math.floor((e.bytesLoaded*100)/e.bytesTotal);

      txtloader.text=percentloaded+"%";

       

       

      if(percentloaded==100){

      detectKey(); // here's the error

      }

       

      }