2 Replies Latest reply on Feb 8, 2012 9:12 AM by flexercised

    Different Layouts for Portrait/Landscape & Other General Questions




      I am writing an iPad App on no Flex experience whatsoever. I have some previous Actionscript knowledge though my experience is in Win Form Applications or web development. I think primarily I just need to get my head in the right place, so I have a few questions.


      1. Different Layouts for Portrait/Landscape States


      I really don't seem to understand "states", so I'm not sure if they're what I want to use or not, but I've been struggling with this for a while.

      I want a label on the page that says "Your device is in Portrait Mode" etc. However when you rotate the device, it will change to "Your Device is in Landscape Mode".

      The purpose of this is so I have completely different layouts (changing everything from text values to alignment etc) for each mode.


      2. Different "Pages"/Views


      Another thing that just seems an alien concept to me, but it is also prevalent in Windows phone Development.

      I have a collection of links/buttons/wahtever and when I click one I want it to take me to a different page with text.



      Thank you for any assistance in these areas.

        • 1. Re: Different Layouts for Portrait/Landscape & Other General Questions
          JDredgy Level 1

          OK, I'm trying to use an event listener but I'm not sure where to put the code.

          I have App.mxml and AppHomeView.mxml, I only want the change to be applied to home view, so in that file I'm placing:



          function orientateApp(event:Event):void {

               statuslabel.text = stage.width.toString();



          stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientateApp);[/code]


          And it just gives me  an error for access to unidentified property.

          • 2. Re: Different Layouts for Portrait/Landscape & Other General Questions
            flexercised Level 3

            <?xml version="1.0" encoding="utf-8"?>

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








                        private function init():void {

                            stage.addEventListener(StageOrientationEvent.ORIENTATION_CHANGE, orientateApp);



                        private function orientateApp(event:StageOrientationEvent):void {

                            statuslabel.text = stage.width.toString();





                <s:Label id="statuslabel"/>