6 Replies Latest reply on Jan 27, 2010 2:55 PM by Chet Haase

    Bug with transition

    teocomi

      Hello, I have added a transition to the spark button skin and now I get this error (only if moving the mouse quickly over and out the button):

       

      TypeError: Error #1009: Cannot access a property or method of a null object reference.
          at spark.primitives.supportClasses::GraphicElement/get filters()[E:\dev\gumbo_beta2\frameworks\projects\spark\src\spark\primitives\supportClasse s\GraphicElement.as:879]
          at spark.effects::AnimateTransitionShader/getValueFromTarget()[E:\dev\gumbo_beta2\frameworks \projects\spark\src\spark\effects\AnimateTransitionShader.as:273]
          at mx.effects::Effect/http://www.adobe.com/2006/flex/mx/internal::captureValues()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\effects\Effect.as:1463]
          at mx.effects::CompositeEffect/http://www.adobe.com/2006/flex/mx/internal::captureValues()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\effects\CompositeEffect.as:376]
          at mx.effects::CompositeEffect/http://www.adobe.com/2006/flex/mx/internal::captureValues()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\effects\CompositeEffect.as:376]
          at mx.effects::Effect/play()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\effects \Effect.as:1188]
          at mx.core::UIComponent/commitCurrentState()[E:\dev\gumbo_beta2\frameworks\projects\framewor k\src\mx\core\UIComponent.as:9344]
          at mx.core::UIComponent/setCurrentState()[E:\dev\gumbo_beta2\frameworks\projects\framework\s rc\mx\core\UIComponent.as:9220]
          at mx.core::UIComponent/set currentState()[E:\dev\gumbo_beta2\frameworks\projects\framework\src\mx\core\UIComponent.a s:5740]
          at spark.components.supportClasses::SkinnableComponent/commitProperties()[E:\dev\gumbo_beta2 \frameworks\projects\spark\src\spark\components\supportClasses\SkinnableComponent.as:374]
          at spark.components.supportClasses::ButtonBase/commitProperties()[E:\dev\gumbo_beta2\framewo rks\projects\spark\src\spark\components\supportClasses\ButtonBase.as:685]
          at mx.core::UIComponent/validateProperties()[E:\dev\gumbo_beta2\frameworks\projects\framewor k\src\mx\core\UIComponent.as:7387]
          at mx.managers::LayoutManager/validateProperties()[E:\dev\gumbo_beta2\frameworks\projects\fr amework\src\mx\managers\LayoutManager.as:572]
          at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\gumbo_beta2\frameworks\projects \framework\src\mx\managers\LayoutManager.as:730]
          at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\gumbo_beta2\frameworks\ projects\framework\src\mx\managers\LayoutManager.as:1069]

       

      the transition is a very simple one, so I guess it could be a bug:

       

          <s:transitions>
              <s:Transition fromState="*" toState="up" autoReverse="true">
                  <s:Sequence>
                      <s:Parallel>
                          <s:Wipe direction="down" target="{rect1}"  duration="200"/>
                      </s:Parallel>   
                      <s:RemoveAction targets="{[rect1, rect2]}"/>
                  </s:Sequence>                   
              </s:Transition>
              <s:Transition fromState="up" toState="*" autoReverse="true">
                  <s:Sequence>
                      <s:AddAction targets="{[rect1, rect2]}"/>
                      <s:Parallel>
                          <s:Wipe direction="up" target="{rect1}"  duration="200"/>
                      </s:Parallel>                   
                  </s:Sequence>                   
              </s:Transition>       
          </s:transitions>

        • 1. Re: Bug with transition
          Shongrunden Adobe Employee

          Looks like it might be a bug, I have filed it here:

          http://bugs.adobe.com/jira/browse/SDK-25234

          • 2. Re: Bug with transition
            teocomi Level 1

            thanks


            • 3. Re: Bug with transition
              Chet Haase Level 3

              I'm chasing down the cause of the bug. The root cause seems to be coming from our inadvertently re-launching an effect when it's already running (which eventually results in our assuming non-null filters for the Wipe effect because one of the instances resets the value when it ends).

               

              I'm not sure exactly why the effect its getting re-launched, but I think it's related to an oddity in the skin code. You're currently running AddAction and RemoveAction in the transition even though the object (rect1) is present in both states. I think the act of adding/removing it as the transition is running is throwing a wrench in the works of what the transition is doing.

               

              I removed those effects from the Sequence and couldn't reproduce the problem. Give it a shot and let us know.

               

              Chet.

              • 4. Re: Bug with transition
                Chet Haase Level 3

                and just because I feel like more information is always better....

                 

                There is a real bug here. The test code had an erroneous Add/RemoveAction in the transitions, as I said before. But it turns out that the way we handle seeking in a Sequence effect is wrong, and just happens to be triggered by that example. There are other ways that you could hit the same problem with code that is totally valid.

                 

                The way we handle autoReverse behavior on transitions ends up seeking (setting the playheadTime property) after calling play() on the next transition effect. And the behavior in Sequence is broken for doing this because it ends up calling play() on the currently running effect (which has already been started). And this triggers the bug you ran into with AnimateTransitionShader effect because we end up resetting an internal variable to null when the effect instance ends. But when the first instance ends, the second one is still running and slams into that null property.

                 

                One quick workaround for your code is to not use autoReverse="true" (if you have a valid reason to use Sequence around an AnimateTransitionShader/Wipe/CrossFade effect) because this behavior is broken in Sequence. In the meantime, I'll be working on a fix...

                 

                Thanks for reporting the problem.

                 

                Chet.

                • 5. Re: Bug with transition
                  teocomi Level 1

                  Thank you for the answer !

                  • 6. Re: Bug with transition
                    Chet Haase Level 3

                    By the way, just checked in the fix for this. Still working on the larger fix for Sequence, but that probably won't make 4.0. But the fix for making Wipe/CrossFade work inside auto-reversing Sequence transitions went in today.

                     

                    Chet.