topical media & game development
actionscript-application-flickr-PhotoViewer.mx
actionscript-application-flickr-PhotoViewer.mx
[swf]
flex
<?xml version="1.0" encoding="utf-8"?>
<!--
PhotoViewer
-->
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" xmlns:ui="ui.*"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
clipContent="true">
<mx:Metadata>
[Event(name="favorite",type="com.adobe.flickr.events.FavoriteEvent")]
[Event("hideView")]
</mx:Metadata>
<mx:states>
<mx:State name="loadingState">
<mx:SetProperty target="{loading}" name="visible" value="true" />
<mx:SetProperty target="{photoTitle}" name="text" value="" />
</mx:State>
</mx:states>
<mx:Script>
<![CDATA[
import com.adobe.flickr.interfaces.ISlideShow;
import mx.collections.ArrayCollection;
import mx.utils.ArrayUtil;
import mx.printing.*;
import com.adobe.flickr.events.*;
[Bindable]
public var title:String;
[Bindable]
private var __selectedPhoto:*;
public function set selectedPhoto( photo:* ) : void
{
__selectedPhoto = photo;
if( __selectedPhoto.title == null ) __selectedPhoto.title = "- untitled -";
}
public function get selectedPhoto() : *
{
return __selectedPhoto;
}
[Bindable]
public var __selectedPhotoInfo:*;
public function set selectedPhotoInfo( info:Object ) : void
{
__selectedPhotoInfo = info;
}
public function set source( url:String ) : void
{
img.source = url;
img.hideImage();
currentState = "loadingState";
}
public var viewer:ISlideShow;
private function nextPhoto() : void
{
if( viewer != null ) viewer.nextPhoto();
}
private function prevPhoto() : void
{
if( viewer != null ) viewer.prevPhoto();
}
private function addToFavorites() : void
{
var fv:FavoriteEvent = new FavoriteEvent(selectedPhoto);
dispatchEvent( new FavoriteEvent(selectedPhoto) );
}
private function printImage() : void
{
var pj:FlexPrintJob = new FlexPrintJob();
if( !pj.start() ) return;
pj.addObject(img,FlexPrintJobScaleType.SHOW_ALL);
pj.send();
}
]]>
</mx:Script>
<mx:Text id="photoTitle" top="2" left="2" right="2"
text="{__selectedPhoto.title}" styleName="photoTitle" />
<mx:HBox top="24" left="2" right="2" bottom="25" horizontalGap="0" paddingTop="8">
<mx:VBox height="100%" width="30" horizontalAlign="center" verticalGap="6" >
<mx:Button width="25" height="22" styleName="photoViewCloseButton"
toolTip="Closes this view"
click="dispatchEvent(new Event('hideView'))" />
<mx:Button width="25" height="22" styleName="photoViewPrintButton"
toolTip="Prints the Photo" click="printImage()" />
<mx:Button width="25" height="22" styleName="photoViewFavoritesButton"
toolTip="Add to Favorites" click="addToFavorites()" />
<mx:LinkButton width="25" height="22" styleName="photoViewPrevButton"
toolTip="Previous Photo" click="prevPhoto()" />
<mx:LinkButton width="25" height="22" styleName="photoViewNextButton"
toolTip="Next Photo" click="nextPhoto()" />
</mx:VBox>
<mx:Accordion id="accordion"
width="100%"
height="100%"
creationPolicy="all"
historyManagementEnabled="false"
selectedIndex="0">
<mx:VBox label="Photo" width="100%" height="100%" styleName="photoSpace" >
<actionscript_application_flickr_ImageMixer id="img" width="100%" height="100%"
complete="currentState=''" />
</mx:VBox>
<actionscript_application_flickr_PhotoDetails label="Details" id="canvas1" width="100%" height="100%"
data="{__selectedPhotoInfo}" >
</actionscript_application_flickr_PhotoDetails>
</mx:Accordion>
</mx:HBox>
<!-- <mx:Label id="loading" text="Loading" styleName="loadingLabelLarge"
visible="false"
left="0" right="0" bottom="2" /> -->
<mx:Image id="loading" source="@Embed(source='actionscript-application-flickr-assets-skins.swf',symbol='loadingImage')"
visible="false"
horizontalCenter="0" bottom="2" />
</mx:Canvas>
(C) Æliens
27/08/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.