|
|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
TOP COLDFUSION LINKS Java Industry News
A Complete Application with RPC Communications...
... between Flex and Java
Oct. 12, 2007 11:00 AM
Digg This!
Page 1 of 4
next page »
This is a book excerpt from the book RIch Internet applications with Adobe Flex and Java.
<destination id="YahooFinancialNews">
Processing the News Feed If we knew that the results were coming back as name/value pairs concatenated with an ampersand, we could have picked the flashvars format. The text format is suitable for any raw text, but it's not easy to parse. The XML format is maintained for compatibility with pre-E4X versions of the ActionScript, so we'll pass on this one as well. Considering the other formats listed above, for our application, we prefer e4X XML. An e4X expression newsFeed.lastResult.channel.item is all you need to populate the XMLListCollection with news headlines. This XMLListCollection will be used as the dataProvider of the news DataGrid. As usual, we'll separate the code that merely starts the application from the FinancialNews view ( see Listing 1).
<?xml version="1.0" encoding="utf-8"?> Our newsFeed will initiate the following request from the creationComplete event: newsFeed.send({s:"ADBE"});
As part of the send method, Flex converts the object's property into a GET URL parameter using the object's properties as parameter names. Here s:"ADBE" will be concatenated in the form of "?s=ADBE" to the http://finance.yahoo.com/rss/headline specified by the news destination. Since RSS data can be verbose, we'll set the relevant columns of the grid with wordWrap="true" and the height of the Grid row to be flexible:
Introducing Item Renderers • drop-in, which is an ActionScript class that you specify as the value of the itemRenderer of any list-derived control. • inline, where you use an <mx:Component> tag to define a renderer component inside the <mx:itemRenderer> element. To create an inline renderer, we'd need to change: <mx:DataGridColumn headerText="Link" width="130" dataField="link" wordWrap="true"/> into the following code:
<mx:DataGridColumn headerText="Link" width="130"> The ActionScript function flash.net.navigateToURL opens or replaces a window in the Flash Player's container application - opens it, in our case, in a blank browser. While inline renderers excel in readability, drop-in renderers are reusable. If you expect to have links with similar presentation and functionality you may decide to create a class out of it. Let us introduce the write-only security property for the FinancialView2 class. Please note that we provide a setter method to send a newsFeed request every time the security (stock symbol) is updated:
public function set security(value:String):void { Page 1 of 4 next page » CFDJ LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
|||||||||||||||||||||||||||||||||||||||||||||||||||||