Screen Options
There are several options available to programmatically control several areas of the screen layout. These options include the layout of the application, whether or not to show the action bar in a view-based or tabbed application, and whether or not to show the application in full screen mode. This sample application can be seen in Figure 6-13.
Layout
The options for your application layout are portrait (where the
application shows vertically in the device), or landscape (where the
application appears horizontally). Setting the aspect ratio by calling
the setAspectRatio
method on the
stage
can change the application’s layout. The
StageAspectRatio
class contains two static values
that should be used to set the aspect ratio.
The code below includes a RadioGroup
with the
id
of orientation
. There are two
RadioButton
components in this
group with values of portrait
and
landscape
. When clicking on one of these radio
buttons, the radiobutton1_clickHandler
method is
called. Within this method, the
orientation.selectedValue
is tested.
If orientation.selectedValue
is equal to
portrait
, the stage.setAspectRatio
method is called and Stage
Aspect
Ratio.
PORTRAIT
is passed in. If orientation.selectedValue
is equal to landscape
, the
stage.setAspectRatio
method is called and StageAspectRatio
.LANDSCAPE
is passed in.
The results can be seen in Figure 6-14.
Figure 6-13. Screen options application ...
Get Developing iOS Applications with Flex 4.5 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.