1 Reply Latest reply on Sep 10, 2011 12:22 PM by Shongrunden

    stage orientation event.

    home_aidan Level 1

      Hi guys,


      I have one spark view that is orientated to landscape and the other to portrait. I get discrepancies in the layout of the views even if I use...




      ..to make sure the orientation has changed before "pushing" to the next view. once the above events trigged i then use...


      ...to go to my next view.

      But it still orientated some of the components to previous orientation.




      On a slight diffrent subject, that might go some way to helping me with the above.

      In flex, is it possible to fire some script before laying out the components?


      so somthing like this....


      <?xml version="1.0" encoding="utf-8"?>
      <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
                xmlns:s="library://ns.adobe.com/flex/spark" title="TEST" contentCreationComplete="displayLayout">
                <!-- Place non-visual elements (e.g., services, value objects) here -->
                     public function displayLayout():void{
                          //SOME CODE HERE THAT "RUNS" testGroup     
           <s:VGroup id="testGroup">
                <s:Button label="TEST"/>




      Or do I have to have testGroup as seperate component thats loads in via a "addElement"?


      Can testGroup "listen" for an event trigged by "displayLayout" and then reinitialize?





        • 1. Re: stage orientation event.
          Shongrunden Adobe Employee

          It sounds like you have two different views for different orientations.  It's probably easier and faster to have a single view and take advantage of the portrait/landscape states:


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




                  <s:State name="portrait" />

                  <s:State name="landscape" />



              <s:Button label="portrait" includeIn="portrait" />

              <s:Button label="landscape" includeIn="landscape" />