2 Replies Latest reply on Apr 1, 2011 1:08 AM by Kalle Werning

    resizing Panel with tabnavigator inside works only at 2nd run

    Kalle Werning

      I have a strange behaviour. IF putting an navigator into a panel, and trying o resize this,

      It will work always only when its revoked again. Also addaction and removeaction doesnt seem to work.

      Any Ideas?

       

       

      <?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"
                     minWidth="955" minHeight="600"
                     width="100%" height="100%"
                     currentState="State1"
                     initialize="init()">
         
          <s:layout>
              <s:BasicLayout/>
          </s:layout>

       

          <fx:Script>
              <![CDATA[
                  import flash.utils.Timer;
                  import flash.events.TimerEvent;
                  import flash.events.Event;

       

                  private var timer:Timer;
                 
                  private function init():void {
                      timer = new Timer(5000);
                      timer.addEventListener(TimerEvent.TIMER, switcher);
                      timer.start();
                  }

       

                 
                  public function switcher(event:TimerEvent):void {
                      if (currentState =="State1") {
                          currentState = "State2";
                      } else  {
                          currentState = "State1";
                      }
                  }
                 
              ]]>
          </fx:Script>
         
         
          <s:states>
              <s:State name="State1"/>
              <s:State name="State2"/>
          </s:states>
         
          <s:transitions>
              <s:Transition fromState="State1" toState="State2">
                  <s:Resize target="{mainPanel}" />
              </s:Transition>
             
              <s:Transition fromState="State2" toState="State1">
                  <s:Resize target="{mainPanel}" />
              </s:Transition>
          </s:transitions>

       

          <s:Panel id="mainPanel"
                  horizontalCenter="0" verticalCenter="0"
                   width.State1="250"  height.State1="200"
                   width.State2="98%"  height.State2="95%"
                   >
              <mx:TabNavigator includeIn="State2" left="20" right="20" top="20" bottom="50">
                  <s:NavigatorContent label="Registerkarte 1" width="100%" height="100%">
                  </s:NavigatorContent>
              </mx:TabNavigator>
          </s:Panel>
      </s:Application>