Skip to main content
Participant
Oct 27, 2011 5:37 AM UTC
Question

does flex support Portrait or landscape orientation in Flex Mobile Development

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 is closed to new replies. Start a new post to keep the conversation going.

1 reply

Oct 27, 2011 11:42 AM UTC

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";

            }

Translate