box-o-sand/flex-practice/01-flickr/FlickrRIA.mxml

47 lines
1.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0xFFFFFF, 0xAAAAAA]"
horizontalAlign="left"
verticalGap="15"
horizontalGap="15">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var photoFeed:ArrayCollection;
private function requestPhotos():void {
photoService.cancel();
var params:Object = new Object();
params.format = 'rss_200_enc';
params.tags = searchTerms.text;
photoService.send(params);
}
private function photoHandler(event:ResultEvent):void {
photoFeed = event.result.rss.channel.item as ArrayCollection;
}
]]>
</mx:Script>
<mx:HTTPService id="photoService"
url="http://api.flickr.com/services/feeds/photos_public.gne"
result="photoHandler(event)" />
<mx:HBox>
<mx:Label text="Flickr tags or search terms:" />
<mx:TextInput id="searchTerms" />
<mx:Button label="Search"
click="requestPhotos()" />
</mx:HBox>
<mx:TileList width="100%" height="100%"
dataProvider="{photoFeed}"
itemRenderer="FlickrThumbnail">
</mx:TileList>
</mx:Application>