1 Reply Latest reply on Jul 8, 2011 2:25 PM by Shongrunden

    Problem with spark:resize effect and constraint-layout

    Kalle Werning

      Hi,

       

      maybe its just a missuderstanding, but how i an get this to work.

       

      Also move effects doesnt seem to work.

       

      Does somebody have a Link, where I can get deeeper in constraints and spark.effects?

       

      <?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"
                   
                    horizontalCenter.State2="0" verticalCenter.State2="0"
                    left.State2="20" right.State2="20" top.State2="10" bottom.State2="50">
           </s:Panel>
      </s:Application>

        • 1. Re: Problem with spark:resize effect and constraint-layout
          Shongrunden Adobe Employee

          I think there are bugs in this area for transitioning an objects size between states where two different sizing mechanisms are in play.

           

          If you transition from constraints to constraints or from width/height to width/height it should work better:

           

              <s:Panel id="mainPanel"

                       horizontalCenter="0" verticalCenter="0"

                       left.State1="200" right.State1="200" top.State1="100" bottom.State1="500"

                       left.State2="20" right.State2="20" top.State2="10" bottom.State2="50">