[an error occurred while processing this directive]

Performing Object Introspection

                         

 

In OOP based programming language object introspection is a technique to determining the elements(properties and methods) of a class at run time. There are two ways to do introspection in ctionScript:

 

 

  • The introspection API.
  • for..in loops

In the tutorial we'll use getClassInfo() function which is present in ObjectUtil class.

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Button;
import mx.controls.Alert;
import mx.utils.ObjectUtil;<country label="India" data="IN"/>
private function disProper(b:Button):void
{
var o:Object=ObjectUtil.getClassInfo(b);
TA.text=ObjectUtil.toString(o);
}
]]>
</mx:Script>
<mx:Button label="Display Properties" id="btn1" click="disProper(btn1)" x="148" y="10"/>
<mx:TextArea width="200" height="300" id="TA" x="124" y="50"/>

</mx:Application>


                        

 

                         

[an error occurred while processing this directive]