HTML and CSS Reference
In-Depth Information
In the document body, we need a function call and a div with the text to replace (Listing 6-2).
Listing 6-2. The Function Call and the div with the Original Text
<p>
<a href="javascript:replace()">Click here to replace text</a>
</p>
<div id="repdiv">
Original text in the markup
</div>
The http.open() argument is the asynchronous argument that sends the request in the background.
Flex
Adobe Flex is a software development kit (SDK) for cross-platform, rich Internet applications based on the Adobe
Flash technology [5]. The user interface layout and behavior are described by a declarative XML-based language,
MXML, while the client logic is created by using the ActionScript 3.0 programming language.
actionScript is an object-oriented language and a dialect of eCMaScript. Consequently, actionScript is a super-
set of the syntax and semantics of JavaScript. Most frequently, actionScript is implemented in SWF files.
Note
As an example, let's create a simple RSS news feed reader! First, we need to write a common XML declaration,
followed by an MXML declaration (Listing 6-3).
Listing 6-3. The XML and MXML Declaration
<?xml version="1.0" ?>
<mx:Application xmlns:mx=" http://www.macromedia.com/2003/mxml " >
</mx:Application>
Within the mx:Application , our HTTPService should be defined, and the custom controls (DataGrid, TextArea,
and Button) are prepared for the panel (Listing 6-4).
Listing 6-4. The HTTPService and the Panel for the Custom Controls
<mx:Application xmlns:mx=" http://www.macromedia.com/2003/mxml " >
<mx:HTTPService id="httpRSS" url="http://www.example.com/rss/" resultFormat="object" />
<mx:Panel id="reader" title="Simple RSS Reader" width="600">
</mx:Panel>
</mx:Application
Now it is time to define the DataGrid. The horizontal dimension of the panel should be set by the width
parameter. Each item tag of the RSS file is bound to a DataGrid row by the dataProvider attribute. Next we create an
event handler to display the contents of the description tags inside the RSS items selected by the user. The
entries.selectedIndex variable is used to determine which item was clicked. The description of the corresponding
item is retrieved by httpRSS.result.rss.channel.item[entries.selectedIndex].description . The value of the
RSS description is assigned to the htmlText property of the TextArea (Listing 6-5).
 
 
Search WWH ::




Custom Search