4 Replies Latest reply on Jul 26, 2011 3:36 PM by eegz

    Resize event too early for scrollRect on Full Screen switch

    eegz

      1. Switch to full screen.

      2. Receive resize event.

      3. Check scrollRect of viewport.

      4. ScrollRect is old value from before resize (component size is correct however).

       

       

      To duplicate use the below code.

       

      Steps:

        1. Run code

        2. Click box to go to full screen

        3. Note the size of the viewport is the value from before the resize to full screen

        4. Hit escape to leave full screen

        5. Note that viewport is actually larger than the scroller (it's still the old value from the full screen mode)

       

       

      Are there any hacks or workarounds (or did I mess something up)?

       

       

      ========================================================================

                                                          Code to demonstrate:

      ========================================================================

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                     xmlns:s="library://ns.adobe.com/flex/spark"
                     xmlns:mx="library://ns.adobe.com/flex/mx"
                     click="{stage.displayState = StageDisplayState.FULL_SCREEN}"
                     >
          <fx:Script>
              <![CDATA[
                  import mx.events.FlexEvent;
                  import mx.events.ResizeEvent;
                 
                  protected function scroller1_resizeHandler(event:ResizeEvent):void
                  {
                      trace("myScroller.height:"+myScroller.height);
                      trace("myScroller.viewport.height:"+myScroller.viewport.height);
                  }
                 
                 
              ]]>
          </fx:Script>
          <s:Scroller id="myScroller" top="10" bottom="10" left="10" right="10" resize="scroller1_resizeHandler(event)">
              <s:Group id="myGroup" clipAndEnableScrolling="true">
                  <s:Label backgroundColor="red" width="5000" height="5000" />
              </s:Group>
          </s:Scroller>
      </s:Application>

       

      ========================================================================