NewJson.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="add1()" width="998"><mx:HTTPService
id="h1" url="http://twitter.com/statuses/public_timeline.json" method="POST" resultFormat="text" fault="faull(event)" result="call(event)" /><mx:HTTPService
id="twitterService" url="http://twitter.com/statuses/public_timeline.json"resultFormat="
text" result="onPublicTimelineResult(event)"/><mx:Script>
<![CDATA[
import mx.controls.Alert; import mx.collections.XMLListCollection; import mx.collections.ArrayCollection; import mx.rpc.http.HTTPService; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.formatters.DateFormatter; import com.adobe.serialization.json.JSON;[
Bindable] private var publicTimeline:ArrayCollection;[
Bindable] private var treearr:ArrayCollection;[
Bindable] private var treearr1:XMLListCollection;private
function call( event:ResultEvent ):void{
var rawData:String = String( event.result );Alert.show(
"hi");Alert.show(rawData);
var arr:Array = JSON.decode( rawData ) as Array;treearr =
new ArrayCollection( arr );}
public
function faull(event:FaultEvent):void{
Alert.show(event.message.toString());
}
public
function add1():void{
h1.send();
}
private
function getFormattedDate( item:Object, column:DataGridColumn ):String{
var dateFormatter:DateFormatter = new DateFormatter();dateFormatter.formatString =
"MMMM D, YYYY, J:NN:SS"; return dateFormatter.format( item.created_at );}
private
function getScreenName( item:Object, column:DataGridColumn ):String{
return item.user.screen_name;}
private
function getScreenName1( item:Object):String{
return item.user.screen_name;}
public
function getnode():void{
twitterService.send();
dg1.dataProvider= publicTimeline;
}
private
function onPublicTimelineResult( event:ResultEvent ):void{
var rawData:String = String( event.result ); var arr:Array = JSON.decode( rawData ) as Array;publicTimeline =
new ArrayCollection( arr );}
private
function combochange():void{
}
]]>
</mx:Script>
<mx:Panel
width="976" height="495" layout="absolute"><mx:HBox
x="0" y="0" width="356" height="44"></mx:HBox>
<mx:Tree
id="t1" labelFunction="getScreenName1" dataProvider="{treearr}" x="0" y="52" width="356" height="418" itemClick="getnode()" ></mx:Tree>
<mx:Panel
x="364" y="0" width="582" height="470" layout="absolute"><mx:HBox
x="10" y="10" width="552" height="30"><mx:ComboBox
height="22" width="197" change="combochange()"><mx:String>
All Operations</mx:String><mx:String>
New Accounts</mx:String><mx:String>
Account Updates</mx:String><mx:String>
Incoming Account Transfers</mx:String></mx:ComboBox>
<mx:ComboBox
height="22" width="187"><mx:String>
All</mx:String><mx:String>
To be received</mx:String><mx:String>
Received</mx:String><mx:String>
Approved</mx:String></mx:ComboBox>
</mx:HBox>
<mx:DataGrid
id="dg1" height="366" y="48" width="552" x="10"><mx:columns>
<mx:DataGridColumn
width="200" headerText="Created" labelFunction="getFormattedDate" /><mx:DataGridColumn
width="200" headerText="Screen Name" labelFunction="getScreenName" /><mx:DataGridColumn
headerText="Tweet" dataField="text" /></mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Panel>
</mx:Application>