<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2006 Renaun Erickson (http://renaun.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

All trademarks are of their respective owners.

@ignore
-->
<!--

Flickr Example and Adobe ad idea

Adobe's Flickr and Corelib ActionScript 3.0 Libraries are required for this to work
http://labs.adobe.com/wiki/index.php/ActionScript_3:resources:apis:libraries

-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
    backgroundColor="0xEEEEEE"
    paddingLeft="0" paddingRight="0" paddingBottom="0" paddingTop="10"
    width="146" height="748"
    initialize="getImages()" viewSourceURL="srcview/index.html">
    <mx:Script>
        <![CDATA[
            import com.adobe.webapis.flickr.events.*;
            import com.adobe.webapis.flickr.FlickrService;
            import com.adobe.webapis.flickr.PagedPhotoList;
            import mx.collections.ArrayCollection;
            
            private var API_KEY:String = "<YOUR API_KEY>";
            private function getImages():void {
                var service:FlickrService = new FlickrService( API_KEY );
                service.addEventListener( FlickrResultEvent.PHOTOS_SEARCH, onPhotosSearch );
                service.photos.search( "", txtSearch.text );
            }
            
            [Bindable]
            private var photos:ArrayCollection;
            private function onPhotosSearch( event:FlickrResultEvent ):void {
                var photoList:PagedPhotoList = event.data.photos;
                photos = new ArrayCollection( photoList.photos.slice(0,8) );
            }
        ]]>
    </mx:Script>
    
    <mx:TextArea width="146" height="85"
        verticalScrollPolicy="off"
        paddingLeft="10" paddingRight="10"
        fontSize="12" fontWeight="bold"
        editable="false"
        textAlign="center"
        borderStyle="none"
        backgroundAlpha="0">
        <mx:htmlText>
            <![CDATA[
<p>Redefine RIA 
with 
<font size="16">Adobe Flex!</font></p>
            ]]>
        </mx:htmlText>
    </mx:TextArea>
<mx:Image source="adobe.gif"/>
<mx:Image source="flex.gif" />
    <mx:TextArea width="146" height="160"
        paddingLeft="10" paddingRight="10"
        fontSize="12" fontWeight="bold"
        editable="false"
        textAlign="center"
        borderStyle="none"
        backgroundAlpha="0">
        <mx:htmlText>
            <![CDATA[
<p>Introducing the <font color="#FF0000">R</font>andom 
<font color="#FF0000">I</font>mage <font color="#FF0000">A</font>ccelerator

<font size="10" color="#999999">Flex + Flickr 
RIA App</font></p>
            ]]>
        </mx:htmlText>
    </mx:TextArea>
    
    <mx:TextInput id="txtSearch" text="random" width="100" />
    <mx:Button id="btnSearch" label="Search" click="getImages()" />    
    <mx:TileList dataProvider="{ photos }" 
        borderStyle="none"
        backgroundAlpha="0"
        columnWidth="71"
        itemRenderer="PhotoRenderer" width="144"/>
</mx:Application>