topical media & game development

talk show tell print

professional-flex-code-05-Introspection.mx

professional-flex-code-05-Introspection.mx [swf] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
          
          <mx:Script>
                  <![CDATA[
                  
                          import mx.controls.TextInput;
                          import flash.utils.describeType;
                          
                          public function describeInstance():void
                          {
                                  var classInfo:XML = describeType(txtArea);
                                  
                                  for each (var m:XML in classInfo..method)
                                  {
                          txtArea.text += "Method " + m.@name + "():" + m.@returnType + "\n";
                  }
                          }
                          
                  ]]>
          </mx:Script>
          
          <mx:Button id="btn1" label="Describe Instance" click="describeInstance()" />
          <mx:TextArea id="txtArea" width="50%" height="50%" />
          
  </mx:Application>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.