Skip to main content
Participant
October 27, 2011
Question

does flex support Portrait or landscape orientation in Flex Mobile Development

  • October 27, 2011
  • 1 reply
  • 1414 views

there is few document for this Question.i hope my app to support Horizontal Screen,Vertical Screen

there is difference layout between Portrait And landscape orientation.how can i catch the Change of Screen ,is there any events to used?

the flex Mobile api support that?

Thanks~~~

This topic has been closed for replies.

1 reply

October 27, 2011

You can use resize event of the view or group of 100% size of application.

<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"

         xmlns:s="library://ns.adobe.com/flex/spark"

         xmlns:mx="library://ns.adobe.com/flex/mx"

         resize="view1_resizeHandler(event)">

            

          protected function view1_resizeHandler(event:ResizeEvent):void

            {

                    if (getOrientationUniversal() == "portrait")

                    {   

                        changeToPortrair();

                    }

                    else

                    {

                        changeToLandscape();

                    }

             }

           

            public function getOrientationUniversal():String

            {

                //portrait

                if (height > width)

                    return "portrait";

                else

                    return "landscape";

            }