Title
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
width="440" height="400"
initialize="initializeHandler();"
>
<mx:Script>
<![CDATA[
[Bindable] public var a:XMLList;
[Bindable] public var b:XMLList;
[Bindable] public var c:XMLList;
[Bindable] public var d:XMLList;
// Model: XML structure describing
// some of the books in my collection.
[Bindable]
private var myBooks:XML =
<books>
<book ISBN="1590595181">
<title>Foundation ActionScript Animation: Making Things Move</title>
<author>Keith Peters</author>
<amazonUrl>http://tinyurl.com/npuxt</amazonUrl>
<pageCount>470</pageCount>
</book>
<book ISBN="1582346194">
<title>Send in the Idiots: Stories from the Other Side of Autism</title>
<author>Kamran Nazeer</author>
<amazonUrl>http://tinyurl.com/lo5ts</amazonUrl>
<pageCount>500</pageCount>
</book>
</books>
private function initializeHandler():void
{
// An XML list that contains both book nodes.
a = myBooks.book;
// Keith Peters
b = myBooks.book[0].author;
// 470
c = myBooks.book.(@ISBN=="1590595181").pageCount;
// Delete the first book node.
delete myBooks.book[0];
// Send in the Idiots...
d = myBooks.book[0].title;
}
]]>
</mx:Script>
<!-- User interface -->
<mx:Panel
title="XML lookup results"
paddingBottom="10" paddingLeft="10" paddingRight="10" paddingTop="10">
<mx:Text text="{'a: ' + a}" width="300"/>
<mx:Label text="{'b: ' + b}"/>
<mx:Label text="{'c: ' + c}"/>
<mx:Label text="{'d: ' + d}"/>
</mx:Panel>
</mx:Application>