Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Flex Performing Object Introspection

Related Tutorials


 
 

Share on Google+Share on Google+

Performing Object Introspection

Advertisement
In OOP based programming language object introspection is a technique to determining the elements(properties and methods) of a class at run time.

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>


  

 

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 27, 2006

Related Tutorials

Discuss: Performing Object Introspection  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com