Adobe Flex 4.6 includes several new and updated mobile-optimized Spark components (for example SplitViewNavigator, CallOutButton, SpinnerList, DateSpinner, Text Enhancements and ToggleSwitch).
In this example I used SplitViewNavigator to show Finnkino's Theatres in the first view of the SplitViewNavigator. Second view shows the selected Theatre's movies (what are running at this day) or all movies that are running in Finnkino's Theatres.
<s:SplitViewNavigator id="splitNavigator" width="100%" height="100%" autoHideFirstViewNavigator="true">
<s:ViewNavigator id="areasView" width="200" height="100%" firstView="views.AreaCategory"/>
<s:ViewNavigator id="detailView" width="100%" height="100%" firstView="views.MoviesTileView">
<s:actionContent.portrait>
<s:Button id="navigatorButton" label="Valitse Teatteri"
click="splitNavigator.
showFirstViewNavigatorInPopUp(navigatorButton);"/>
</s:actionContent.portrait>
</s:ViewNavigator>
</s:SplitViewNavigator>
Movies in Landscape mode

SplitViewNavigator is working very nicely and it hide's the first view in navigator when tablet is rotated to Portrait. You should add resize event handling to your application and use states in ActionContent in ViewNavigator.
<s:Application resize="resizeHandler(event);">
protected function resizeHandler(event:ResizeEvent):void {
currentState = aspectRatio;
}
<s:states>
<s:State name="portrait"/>
<s:State name="landscape"/>
</s:states>
Movies in Portrait mode

List and ItemRenderers
I have used List to show all the movie items and own made ItemRenderer to display some basic information (or just movie image when all the movies are selected from the main list).
<s:List id="moviesList"
dataProvider="{data}"
itemRenderer="comps.MovieAreaTile"
horizontalCenter="0"
verticalCenter="0"
width="100%" height="100%"
contentBackgroundColor="#FFFFFF"
change="moviesList_changeHandler(event)"
>
<s:layout>
<s:TileLayout id="tileList"
paddingLeft="5" paddingRight="5" paddingTop="5" paddingBottom="5" horizontalGap="5" verticalGap="5"
columnAlign="justifyUsingWidth"
/>
</s:layout>
</s:List>
// MovieAreaTile
<s:HGroup>
<s:Image source="{data.Images.EventSmallImagePortrait}" />
<s:VGroup>
<s:Label id="title" styleName="title" text="{data.Title}" />
<s:Label id="startTime" styleName="data" text="{data.dttmShowStart}" />
<s:Label id="length" styleName="data" text="{data.LengthInMinutes} min" />
<s:Label id="theatre" styleName="data" text="{data.TheatreAndAuditorium}" />
<s:Label id="genre" styleName="data" text="{data.Genres}" />
</s:VGroup>
</s:HGroup>
All the Movies in Finnkino's Theatres

SQLite: Automatically display same Theatre which was used in previous time
In this example I store theatreID and theatreName to SQLite database every time when a new Theatre is selected. Those values are used when application is started again.
Connection to database:
private function connect(type:Number):void {
dbConn = new SQLConnection();
if (type == CREATE_DB) dbConn.addEventListener(SQLEvent.OPEN, createTable);
else dbConn.addEventListener(SQLEvent.OPEN, getTheatreData);
dbConn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
dbConn.openAsync(dbFile);
}
Create a table:
private function createTable(event:SQLEvent):void {
var dbStatement:SQLStatement = new SQLStatement();
dbStatement.sqlConnection = dbConn;
dbStatement.addEventListener(SQLEvent.RESULT, theatreTableCreated);
dbStatement.addEventListener(SQLErrorEvent.ERROR, errorHandler);
dbStatement.text = "CREATE TABLE IF NOT EXISTS movieTable (id INTEGER PRIMARY KEY AUTOINCREMENT, theatreID TEXT, theatreName TEXT);";
dbStatement.execute();
}
Table is created a first time -> add some sample data to table
private function theatreTableCreated(event:SQLEvent):void {
var dbStatement:SQLStatement = new SQLStatement();
dbStatement.sqlConnection = dbConn;
dbStatement.addEventListener(SQLEvent.RESULT,theatreDataAdded);
dbStatement.addEventListener(SQLErrorEvent.ERROR,errorHandler);
// just set default data when table is created
theatreID = 1015;
theatreName = "Jyväskylä";
dbStatement.text = "INSERT INTO movieTable (theatreID, theatreName) VALUES('"+theatreID+"','"+theatreName+"');";
dbStatement.execute();
}
Theatre (id and name) data is added first time, load events with HTTPService
<fx:Declarations>
<s:HTTPService id="finnkinoArea" showBusyCursor="true" url="{url}"
result="areaHandler(event)"
fault="areaFaultHandler(event)"
/>
</fx:Declarations>
private function theatreDataAdded(event:SQLEvent):void {
loadEvents(theatreID);
}
private function getTheatreData(event:SQLEvent):void {
var dbStatement:SQLStatement = new SQLStatement();
dbStatement.sqlConnection = dbConn;
dbStatement.addEventListener(SQLEvent.RESULT,theatreResult);
dbStatement.addEventListener(SQLErrorEvent.ERROR,errorHandler);
dbStatement.text = "SELECT theatreID, theatreName FROM movieTable where id=1";
dbStatement.execute();
}
TheatreID and name is loaded from SQLite, start loading XML data from Finnkino's service
private function theatreResult(event:SQLEvent):void {
var dbResult:SQLResult = SQLStatement(event.target).getResult();
theatreID = dbResult.data[0].theatreID;
theatreName = dbResult.data[0].theatreName;
// load previous used theatre
loadEvents(theatreID);
}
public function loadEvents(theatreID:uint):void {
// one Teatre
if (theatreID != -1) url = urlBase + theatreID;
// all events from Finnkino
else url = "http://www.finnkino.fi/xml/Events/";
// call HTTPService
finnkinoArea.send();
}
Movie Details
Movie details are shown when user clicks MovieTile from TileView. Finnkino's Service offers a lot of information about the movie. In this example I only display some sample data and movie trailer. Movie trailer can be played in fullscreen mode too (use this only in Landscape - there a some issues in portrait mode - in this example
<s:Scroller width="100%" height="100%">
<s:VGroup width="100%">
<s:HGroup>
<s:Image source="{data.Images.EventLargeImagePortrait}" />
<s:VGroup>
<s:Label text="{data.Title} ({data.OriginalTitle})" styleName="title"/>
<s:Label text="{data.RatingLabel}" styleName="data" />
<s:Label id="startTime" styleName="data" text="{data.dttmShowStart}" />
<s:Label id="length" styleName="data" text="{data.LengthInMinutes} min" />
<s:Label id="genre" styleName="data" text="{data.Genres}" />
<s:Label id="showUrl" styleName="dataBlue" text="{data.ShowURL} - (osta liput)" click="showUrl_clickHandler(event)" />
<s:Label id="eventUrl" styleName="dataBlue" text="{data.EventURL} - (lisätietoa elokuvasta)" click="eventUrl_clickHandler(event)" />
</s:VGroup>
</s:HGroup>
<s:Label text="{movieData.Synopsis}" width="100%" styleName="synopsis" />
<s:VideoPlayer id="myVideo" source="{movieData.Videos.EventVideo.Location}" autoPlay="false" visible="{isVideo}" width="{this.width-20}"/>
<s:Button label="Takaisin" id="takaisin" click="takaisin_clickHandler(event)"/>
</s:VGroup>
</s:Scroller>
Movie details in Landscape mode

Movie details in Portrait mode

Movie trailer in fullscreen

Source codes
- Movies.fxp, Movies.zip
Note
There are a few bugs in this example (too). Sometimes the date is missing from first views, and VideoPlayer is messing up if it is in fullscreen mode in Landscape and you turn the device to portrait.. but now it is working for my purposes
and finally I have only tested this in Samsung Galaxy Tab 10.1 not in mobile...








