Mega Code Archive

 
Categories / Flex / Development
 

Access accessor for a Button with Introspection

<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="getDetails()">     <mx:Script>         import flash.utils.*;         public function getDetails():void {             var classInfo:XML = describeType(button1);             ta2.text = classInfo.toString();             ta1.text = "Class " + classInfo.@name.toString() + "\n";                          for each (var a:XML in classInfo..accessor) {                 if (a.@access == 'writeonly') {                     ta1.text += "Property " + a.@name + " (" + a.@type +")\n";                 }else {                     ta1.text += "Property " + a.@name + "=" + button1[a.@name] + " (" + a.@type +")\n";                 }             }         }       </mx:Script>     <mx:Button label="Submit" id="button1" />     <mx:TextArea id="ta1" width="400" height="200" />     <mx:TextArea id="ta2" width="400" height="200" /> </mx:Application>