How to enable orientation change for some views in Flex Mobile?

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 :)

Answers


Remove the <aspectRatio>portrait</aspectRatio><autoOrients>false</autoOrients> from XML, as it will generalize it for the whole application.

Do it seperately 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.


Need Your Help

How to display all the results from a table from MySQL via static PHP code when the table fields are not always the same

php html

How to display all the results from a table from MySQL via static PHP code when the table fields are not always the same?

Use link_to helper wrap some HTML

ruby-on-rails ruby-on-rails-3

I want to use link_to wrap some HTML,but I meet some problem.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.