I have some views in my mobile app (for both ios and android) whose orientation was fixed to PORTRAIT
using <aspectRatio>portrait</aspectRatio><autoOrients>false</autoOrients>
in the settings xml file.
Now I have added another view which plays video from Youtube and it should be able to play videos, both in LANDSCAPE
& PORTRAIT
orientation. So I came across this question which provides a solution to restrict only 1 orientation (globally for all views), but how can I re-enable orientation change only for one view?
Note: I am using Flash Builder 4.6 with actionscript 3 and youtube api
Any help is appreciated :)
Remove the <aspectRatio>portrait</aspectRatio><autoOrients>false</autoOrients>
from XML, as it will generalize it for the whole application.
Do it separately for each and every view. Since for first view you need a PORTRAIT, do it like this.(Taken from Adobe Docs)
stage.addEventListener( StageOrientationEvent.ORIENTATION_CHANGING, onOrientationChanging );
function onOrientationChanging( event:StageOrientationEvent ):void {
// If the stage is about to move to an orientation we don't support, lets prevent it
// from changing to that stage orientation.
if(event.afterOrientation == StageOrientation.ROTATED_LEFT || event.afterOrientation==StageOrientation.ROTATED_RIGHT )
{
event.preventDefault();
}
}
For the second view, do not define any stage orientation listeners, as you need both PORTRAIT and LANDSCAPE.