src/it/ht/rcs/console/entities/view/components/PhotoNavigator.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:HGroup xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
horizontalAlign="center"
gap="-1"
width="100%">
<fx:Metadata>
[Event(name="addPhoto", type="flash.events.Event")]
[Event(name="removePhoto", type="flash.events.Event")]
[Event(name="previous", type="flash.events.Event")]
[Event(name="next", type="flash.events.Event")]
</fx:Metadata>
<fx:Script>
<![CDATA[
import it.ht.rcs.console.entities.model.Entity;
import locale.R;
[Embed(source='/img/mediaplayers/playSmall.png')]
[Bindable]
private var arrow:Class;
[Bindable]
public var currentIndex:int;
[Bindable]
public var entity:Entity;
private function back():void
{
dispatchEvent(new Event('previous'))
}
private function forward():void
{
dispatchEvent(new Event('next'))
}
]]>
</fx:Script>
<s:HGroup width="100%"
horizontalAlign="left"
paddingTop="6"
visible="{entity.photos.length>0}">
<s:Image source="{arrow}"
id="prevBtn"
rotation="-180"
buttonMode="true"
useHandCursor="true"
click="back()"
enabled="{currentIndex>0}"
visible="{entity.photos!=null && entity.photos.length>1}"/>
<s:Label text="{currentIndex+1+'/'+entity.photos.length}"
visible="{entity.photos.length>1}"/>
<s:Image source="{arrow}"
id="nextBtn"
buttonMode="true"
useHandCursor="true"
click="forward()"
enabled="{currentIndex<entity.photos.length-1}"
visible="{entity.photos!=null && entity.photos.length>1}"/>
</s:HGroup>
<s:HGroup gap="-1"
horizontalAlign="right">
<s:Button width="30"
label="-"
cornerRadius="0"
click="{dispatchEvent(new Event('removePhoto'))}"
visible="{entity.photos!=null && entity.photos.length>0}" enabled="{Console.currentSession.user.is_view_profiles()}"
toolTip="{R.get('REMOVE_PHOTO')}"/>
<s:Button width="30"
label="+"
cornerRadius="0"
click="{dispatchEvent(new Event('addPhoto'))}" enabled="{Console.currentSession.user.is_view_profiles()}"
toolTip="{R.get('ADD_PHOTO')}"/>
</s:HGroup>
</s:HGroup>