Flex File
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" color="#4B5C60" borderColor="#667179" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#5F5E5E, #524D4D]" creationComplete="sendfile.send();">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
public var datastore:XML;
[Bindable]
public var datacollection:XMLList;
private var alert:Alert;
private var coll:Array;
public function retrievedata(event:ResultEvent):void
{
datastore=new XML(event.result);
datacollection=datastore.datas;
}
private function finderror(event:FaultEvent):void
{
var title:String = event.type + " (" + event.fault.faultCode + ")";
var text:String = event.fault.faultString;
alert = Alert.show(text, title);
datacollection.removeAll();
}
public function checking():void
{
Alert.show(datacollection.length());
}
public function alertdescription():void
{
Alert.show(dataprovider.selectedItem.description);
}
]]>
</mx:Script>
<mx:HTTPService id="sendfile" url="assets/xmlfile/empdatas.xml" result="retrievedata(event)" resultFormat="e4x"/>
<mx:DataGrid x="106" y="272" width="682" height="284" id="dataprovider" dataProvider="{datacollection}" change="alertdescription()">
<mx:columns>
<mx:DataGridColumn headerText="ID Number" dataField="id" />
<mx:DataGridColumn headerText="Name" dataField="name"/>
<mx:DataGridColumn headerText="Designation" dataField="Designation"/>
<mx:DataGridColumn headerText="Address1" dataField="padress"/>
<mx:DataGridColumn headerText="Address2" dataField="tadress"/>
</mx:columns>
</mx:DataGrid>
<mx:Button x="106" y="129" label="Data Count" width="100" height="30" click="checking();"/>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" color="#4B5C60" borderColor="#667179" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#5F5E5E, #524D4D]" creationComplete="sendfile.send();">
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
public var datastore:XML;
[Bindable]
public var datacollection:XMLList;
private var alert:Alert;
private var coll:Array;
public function retrievedata(event:ResultEvent):void
{
datastore=new XML(event.result);
datacollection=datastore.datas;
}
private function finderror(event:FaultEvent):void
{
var title:String = event.type + " (" + event.fault.faultCode + ")";
var text:String = event.fault.faultString;
alert = Alert.show(text, title);
datacollection.removeAll();
}
public function checking():void
{
Alert.show(datacollection.length());
}
public function alertdescription():void
{
Alert.show(dataprovider.selectedItem.description);
}
]]>
</mx:Script>
<mx:HTTPService id="sendfile" url="assets/xmlfile/empdatas.xml" result="retrievedata(event)" resultFormat="e4x"/>
<mx:DataGrid x="106" y="272" width="682" height="284" id="dataprovider" dataProvider="{datacollection}" change="alertdescription()">
<mx:columns>
<mx:DataGridColumn headerText="ID Number" dataField="id" />
<mx:DataGridColumn headerText="Name" dataField="name"/>
<mx:DataGridColumn headerText="Designation" dataField="Designation"/>
<mx:DataGridColumn headerText="Address1" dataField="padress"/>
<mx:DataGridColumn headerText="Address2" dataField="tadress"/>
</mx:columns>
</mx:DataGrid>
<mx:Button x="106" y="129" label="Data Count" width="100" height="30" click="checking();"/>
</mx:Application>
XML File
empdatas.xml
<?xml version="1.0" encoding="utf-8"?>
<overalldata>
<datas>
<id>121</id>
<name>kaniskar</name>
<Designation>Webdesigner</Designation>
<padress>Tuticorin</padress>
<tadress>chennai</tadress>
<description>He is working in chennai. He is a webdesigner</description>
</datas>
<datas>
<id>122</id>
<name>Allwin</name>
<Designation>Marketing</Designation>
<padress>Tuticorin</padress>
<tadress>Chennai</tadress>
<description>He is a Marketing person. Now he is in chennai. </description>
</datas>
<datas>
<id>123</id>
<name>Goodwin</name>
<Designation>Software engineer</Designation>
<padress>Madurai</padress>
<tadress>Bangalore</tadress>
<description>He was engineer in MNC. He is a Senior Developer </description>
</datas>
<datas>
<id>124</id>
<name>Thanabalan</name>
<Designation>Businesman</Designation>
<padress>Tuticorin</padress>
<tadress>Tuticorin</tadress>
<description>He is a big Business man in Kommadikottai. </description>
</datas>
<datas>
<id>125</id>
<name>Raja</name>
<Designation>Software</Designation>
<padress>Chennai</padress>
<tadress>Bangalore</tadress>
<description>He was engineer in MNC. He is a Senior Developer </description>
</datas>
<datas>
<id>126</id>
<name>Arasu</name>
<Designation>PHP Developer</Designation>
<padress>Madurai</padress>
<tadress>Meenakshi Temple Street</tadress>
<description>He is working as a PHP Developer. Now He is working in madurai</description>
</datas>
<datas>
<id>127</id>
<name>Boopathi</name>
<Designation>Teacher</Designation>
<padress>Rameshwaram</padress>
<tadress>Temple Street,</tadress>
<description>Now he is in chennai. He is searching another job </description>
</datas>
</overalldata>
No comments:
Post a Comment