Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

Using the interospection API:

In the present API, we will describeType() method which will return an E4X XML object, this kind of object contains the description of the target object in XML format.

Ads

Using the interospection API:

     

 

In the present API, we will describeType() method which will return an E4X XML object, this kind of object contains the description of the target object in XML format. This method accesses only public member.

In this tutorial you can see a new loop called for each in, it is slightly different from for each loop, for each loop access the elements randomly and for each in loop works on a specific property.

 

 

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="getProperties()">

<mx:Script>
<![CDATA[
import flash.utils.*;

public function getProperties():void
{
var info:XML=describeType(btn1);
txt1.text=info.toString();
txt2.text=info.@name.toString();
for each (var v:XML in info..variable)
{
txt2.text+="Variable=" +v.@name+"="+btn1[v.@name]+"("+v.@type+")\n";
}
for each(var a:XML in info.accessor)
{
if(a.@access=='writeonly')
{
txt2.text+="Property="+a.@name+"("+a.@type+")\n";
}
else
{
txt2.text+="Property="+a.@name+"="+btn1[a.@name]+"("+a.@type+")\n";
}
}
for each (var m:XML in info..method)
{
txt2.text+="Method="+m.@name+"="+btn1[m.@name]+"("+m.@returnType+")\n";
}

}

]]>
</mx:Script>
<mx:Button id="btn1" label="Click" x="320" y="106"/>
<mx:TextArea id="txt1" height="250" width="250" x="360" y="152"/>
<mx:TextArea id="txt2" height="250" width="250" x="106" y="152"/>
</mx:Application>


  

 

Advertisements

Online Training Classes

Share on Google+Share on Google+

Using the interospection API:

Posted on: February 16, 2005 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Using the interospection API:  

Post your Comment


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

Ads

 

Ads