Using Keyboard Event and dynamic textfield in actionscript 3.0

This is a basic example of keyboard Event and Dynamic textfield.I also want to share you a handful shortcur which i found today using “Flash Builder Burrito”, that is “CTRL + SHIFT + D”, to use just click on top of your function Definition and press this shortcut this will create a multiline comment block for commenting function,  

 package

 {

      import flash.display.MovieClip;

      import flash.events.KeyboardEvent;

      import flash.text.TextField;

      public class KeyBoardEventTest extends MovieClip

      {

           private var outputText:TextField;

           public function KeyBoardEventTest()

           {

                super();

                init()

           }

           /**

            * This function Initilize Event

            */

           protected function init():void

           {

                // creating a dynamic textfield for key logging

                outputText = new TextField();

                outputText.x = 0

                outputText.y = stage.stageHeight >> 1;

                outputText.width = stage.stageWidth;

                outputText.height = stage.stageHeight >> 1;

                outputText.border = true;

                outputText.selectable = true;

                outputText.multiline = true;

                outputText.wordWrap = true;

                addChild(outputText);

                stage.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);

                stage.addEventListener(KeyboardEvent.KEY_UP,onKeyUp);

           }

           /**

            * Listener for Keyboard KEY_DOWN Event

            * @param e

            * 

            */          

           protected function onKeyDown(e:KeyboardEvent):void

           {

                trace("onKeyDown # keyCode :"+e.keyCode+", charCode:"+e.charCode);

           }

           /**

            * Listener for Keyboard KEY_UP Event

            * @param e

            * 

            */          

           protected function onKeyUp(e:KeyboardEvent):void

           {

                trace("onKeyUp # keyCode :"+e.keyCode+", charCode:"+e.charCode);

           }

           /**

            * Custom trace function 

            * @param value

            * 

            */          

           private function trace(value:*):void

           {

                outputText.appendText("\n"+String(value));

           }

      }

 }