a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
37
flex-practice/custom-03d4-tilelist/TileListApp.as
Normal file
37
flex-practice/custom-03d4-tilelist/TileListApp.as
Normal file
@@ -0,0 +1,37 @@
|
||||
package
|
||||
{
|
||||
import mx.core.Application;
|
||||
import mx.controls.TextInput;
|
||||
import mx.controls.Text;
|
||||
import mx.collections.ArrayCollection;
|
||||
import mx.events.ListEvent;
|
||||
import mx.rpc.events.ResultEvent;
|
||||
import mx.rpc.http.HTTPService;
|
||||
|
||||
public class TileListApp extends Application
|
||||
{
|
||||
[Bindable]
|
||||
public var photoFeed:ArrayCollection = new ArrayCollection();
|
||||
public var searchTerms:TextInput;
|
||||
public var photoService:HTTPService;
|
||||
public var textMessage:Text;
|
||||
|
||||
public function requestPhotos():void {
|
||||
var params:Object = new Object();
|
||||
params.format = 'rss_200_enc';
|
||||
params.tags = searchTerms.text;
|
||||
photoService.send(params);
|
||||
}
|
||||
|
||||
public function photoHandler(event:ResultEvent):void {
|
||||
photoFeed = event.result.rss.channel.item as ArrayCollection;
|
||||
}
|
||||
|
||||
//show text message when user selects image
|
||||
public function showMessage(event:Event):void {
|
||||
textMessage.text = "You selected: " +
|
||||
event.currentTarget.selectedItem.title + "\nUploaded by: " +
|
||||
event.currentTarget.selectedItem.credit;
|
||||
}
|
||||
}
|
||||
}
|
38
flex-practice/custom-03d4-tilelist/TileListExample.mxml
Normal file
38
flex-practice/custom-03d4-tilelist/TileListExample.mxml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<loc:TileListApp xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
styleName="basic-app" xmlns:loc="*">
|
||||
<mx:Style source="tilelist.css" />
|
||||
|
||||
<!-- photo service -->
|
||||
<mx:HTTPService id="photoService"
|
||||
url="http://api.flickr.com/services/feeds/photos_public.gne"
|
||||
result="photoHandler(event)" />
|
||||
|
||||
<!-- search -->
|
||||
<mx:Form>
|
||||
<mx:FormItem label="Search Term" direction="horizontal">
|
||||
<mx:TextInput id="searchTerms" />
|
||||
<mx:Button label="Search" click="requestPhotos()" />
|
||||
</mx:FormItem>
|
||||
</mx:Form>
|
||||
|
||||
<!-- result, data is passed to the itemRenderer by Flex
|
||||
through the data property -->
|
||||
<mx:TileList id="mylist"
|
||||
styleName="basic-style-list"
|
||||
labelField="thumbnail"
|
||||
dataProvider="{photoFeed}"
|
||||
itemClick="showMessage(event)">
|
||||
<mx:itemRenderer>
|
||||
<mx:Component>
|
||||
<mx:VBox styleName="basic-vbox">
|
||||
<mx:Image styleName="basic-image"
|
||||
source="{data.thumbnail.url}"/>
|
||||
</mx:VBox>
|
||||
</mx:Component>
|
||||
</mx:itemRenderer>
|
||||
</mx:TileList>
|
||||
|
||||
<mx:Text id="textMessage" styleName="basic-text" />
|
||||
|
||||
</loc:TileListApp>
|
39
flex-practice/custom-03d4-tilelist/tilelist.css
Normal file
39
flex-practice/custom-03d4-tilelist/tilelist.css
Normal file
@@ -0,0 +1,39 @@
|
||||
.basic-app {
|
||||
backgroundColor: #ffffff;
|
||||
backgroundAlpha: 0;
|
||||
horizontalAlign: left;
|
||||
verticalGap: 15;
|
||||
horizontalGap: 15;
|
||||
}
|
||||
|
||||
.basic-style-list {
|
||||
width: 600;
|
||||
height: 200;
|
||||
paddingTop: 25;
|
||||
left: 5;
|
||||
}
|
||||
|
||||
|
||||
.basic-form-item {
|
||||
direction: horizontal;
|
||||
}
|
||||
|
||||
|
||||
.basic-vbox {
|
||||
width: 125;
|
||||
height: 125;
|
||||
paddingRight: 5;
|
||||
paddingLeft: 5;
|
||||
horizontalAlign: center;
|
||||
}
|
||||
|
||||
|
||||
.basic-image {
|
||||
height: 75;
|
||||
width: 75;
|
||||
}
|
||||
|
||||
|
||||
.basic-text {
|
||||
paddingTop: 20;
|
||||
}
|
Reference in New Issue
Block a user