7 Replies Latest reply on Jan 26, 2009 7:39 AM by kglad

    Functions, exchanging information

    fungus13 Level 1




      I have nested functions, I have removed most of the code.

      function QA(event:MouseEvent):void {

      function reportKeyDown2(event:KeyboardEvent):void {
      trace("Key Pressed: " + String.fromCharCode(event.charCode) +
      " (Key code: " + event.keyCode + ")");
      if (event.keyCode == 81 || event.keyCode == 73) {
      keyNote = "C";
      :
      More code
      }
      stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown2);
      }

      btStart.addEventListener(MouseEvent.CLICK,QA);


      I am not very familiar with functions - could anyone explain how I can modify this to exchange information between functions.
      E.g. pass the "Key pressed" to the outer function. Is there a useful text on ActionScript 2 (CS3). While working with it is interesting, it is also a constant frustration, as it is hard to find solutions to the problems that arise. At distance resolution has failed to resolve any of my issues so far.
      Thanks