I want to see an example of an application that uses Network Monitor.
Follow the steps below to try out Network Monitor using this simple application that uses an HTTPService to query the Latest Adobe News RSS feed.
1. Create a new Flex Project in Adobe Flash Builder 4.
2. Paste the following code into the main MXML file:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/halo"
minWidth="1024" minHeight="768"
creationComplete="service.send()">
<fx:Script>
<![CDATA[import mx.rpc.events.FaultEvent;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
protected function service_resultHandler(event:ResultEvent):void
{
Alert.show("Result is " + event.result.RDF.channel.description);
}
protected function service_faultHandler(event:FaultEvent):void
{
Alert.show("Fault: " + event.fault.faultString);
}
]]>
</fx:Script>
<fx:Declarations>
<mx:HTTPService id="service"
url="http://feeds.adobe.com/xml/rss.cfm?query=byMostRecent&languages=1"
result="service_resultHandler(event)"
fault="service_faultHandler(event)"
/>
</fx:Declarations>
</s:Application>
3. Make sure Network Monitor is enabled by switching to the Network Monitor view and clicking the Enable Monitor button on the top right of the tab.
4. Run the application to view the request and response in the Network Monitor view.
This example was part of a larger article. To see the article in its entirety, please see Anirudh Sasikumar's piece on the Flex Developer Center: Extracting maximum value from the Flash Builder 4 Network Monitor.
+