blob: 8f7f8d482a45c7053a010409e9b677d699218c15 [file] [log] [blame]
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="Showcase" viewActivate="init(event)">
<fx:Script>
<![CDATA[
import mx.collections.XMLListCollection;
import mx.rpc.events.ResultEvent;
import spark.events.IndexChangeEvent;
import spark.events.ViewNavigatorEvent;
protected function init(event:ViewNavigatorEvent):void
{
showcaseService.url = "http://flex.apache.org/showcase/data/showcase.xml";
showcaseService.send();
}
protected function shocaseService_resultHandler(event:ResultEvent):void
{
showcaseList.dataProvider = new XMLListCollection(new XMLList(event.result.app));
}
protected function selectApp(event:IndexChangeEvent):void
{
navigator.pushView(ShowcaseDetails, showcaseList.selectedItem);
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="showcaseService" result="shocaseService_resultHandler(event)" resultFormat="e4x" />
</fx:Declarations>
<s:List id="showcaseList" width="100%" height="100%" change="selectApp(event)">
<s:itemRenderer>
<fx:Component>
<s:IconItemRenderer labelFunction="myLabelFunction" messageFunction="myMessageFunction">
<s:decorator>
<s:MultiDPIBitmapSource source160dpi="@Embed('assets/icons/160/1_navigation_next_item.png')"
source240dpi="@Embed('assets/icons/240/1_navigation_next_item.png')"
source320dpi="@Embed('assets/icons/320/1_navigation_next_item.png')"/>
</s:decorator>
<fx:Script>
<![CDATA[
private function myLabelFunction(item:Object):String{
return data.@title;
}
private function myMessageFunction(item:Object):String{
return data.@author;
}
/* Disabled by now.
private function myIconFunction(item:Object):String{
if(data.images == undefined){
return "";
} else {
return "http://flex.apache.org/showcase/images/"+data.images.@baseDir+"/prev/"+data.images.image[0].@file;
}
}*/
]]>
</fx:Script>
</s:IconItemRenderer>
</fx:Component>
</s:itemRenderer>
</s:List>
</s:View>