GETTING DATA FROM XML


<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute”>
<mx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.controls.Alert;
public var dat:XML=<info>
<name>selva</name>
<reg>12</reg>
</info>
private function getdat():void
{
Alert.show("hai");
tex.text="name:"+dat.name;
tex.text="\n"+tex.text+"\nreg:"+dat.reg;

}
]]>
</mx:Script>
<mx:Button x=”189″ y=”94″ label=”GET DATA” click=”getdat()”/>
<mx:TextArea id=”tex” x=”154″ y=”155″ height=”90″ />
</mx:Application>

In this i have a XML object dat which has the data name and regno.

I have binded the data to the text area  in the getda() function.

for viewing the output download from:

http://www.box.net/shared/rtniieng68

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.