StageOrientation.UPSIDE_DOWN
is 180 degrees from StageOrientation.NORMAL
, so if normal is landscape then upside down is also upside down and some devices don't support that. I would suggest using height and width to determine the absolute orientation rather than the relative and react to that
if (stage.width > stage.height)//we are in landscape
{
if(stage.orientation == StageOrientation.NORMAL || stage.deviceOrientation == StageOrientation.NORMAL)
{
stage.setOrientation(StageOrientation.ROTATED_LEFT);
}
else
{
stage.setOrientation(StageOrientation.NORMAL);
}
}
Also it's worth noting that there is a difference between stage.orientation
and stage.deviceOrientation
you can read about this in more detail here