7 Replies Latest reply on Nov 17, 2009 5:48 PM by schipmold

    State transition of excluded object

    schipmold

      Hi all,

       

      I noticed that when an object is excluded from a state and you change to that state, the transitions for that object are ignored completely.

       

      i.e. I've got a panel that is visible in the current state but excluded from the next. I've also setup a fade effect to change the alpha of the panel to 0.0 as the state changes.

      Now this fade effect is skipped completely when the panel is excluded from the target state.

       

      However, when I change it so the panel is not excluded from the target state but has an alpha of 0.0 the fade effect is done nicely.

       

      Not sure if I'm missing something here, but isn't the whole point of states that you can exclude objects from certain states and have transitions to make it all look nice? Or does anyone know if this is a bug of beta 2?

       

      Thanks

      Skip

        • 1. Re: State transition of excluded object
          Shongrunden Adobe Employee

          There were a couple bugs fixed in this area recently.  I'm not sure if they cover your use case, but can you try a recent build of the SDK to see if it's fixed?

           

          You can download a recent nightly build here:

          http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4

           

          If that doesn't work then let us know and we can try to figure out what is going wrong.

          • 2. Re: State transition of excluded object
            schipmold Level 1

            Thanks for that, I just tried with build 11885 but it still seems to exclude the panel before doing the transition effect.

            Ah well, at least it's not me going absolutely bonkers :-)

             

            Would you like me to send you an example project?

             

            Thanks

            Skip

            • 3. Re: State transition of excluded object
              CoreyRLucier Adobe Employee

              Can you have Chet peek at this first?  I think it's unrelated to 

              deferred instantation which is what those bug fixes addressed.

               

              Sent from my iPhone

              • 4. Re: State transition of excluded object
                schipmold Level 1

                Not sure how to contact Chet, but I've attached two apps instead ;-)

                 

                "excludeTest" has a skin that manages the transition from "state1" to "state2" by a fade of two panels.

                Each panel is only included in one of the two states.

                This shows that the panel is excluded from the state before the actual effect has started.

                 

                "fadeTest" is my ugly workaround where both panels are included in both states, but they have an alpha of 0.0 when i don't want to show them.

                Now the fade effect is applied correctly when switching states.

                 

                Could you please have a look at this and let me know if I'm doing something incredibly stupid or if this is indeed a bug?

                 

                Thanks

                Skip

                • 5. Re: State transition of excluded object
                  CoreyRLucier Adobe Employee

                  Whoops, apologies, meant that response re. Chet to be private.     We'll have a look at the issue, thanks for the extra info.

                   

                  -C

                  • 6. Re: State transition of excluded object
                    CoreyRLucier Adobe Employee

                    Well, starting off with a very simple test case (below), things seem to work in the general/common case.

                     

                    I believe it may just be that you are trying to transition upon a state change in your skin when your parent application state has not fully completed.   It is a bit strange for a skin to be reaching up into its host component and trying to affect and transition display objects that aren't even part of the same document.  Why not just have the app transition its own panels?

                     

                    <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/halo" minWidth="1024" minHeight="768">

                     

                        <s:states>
                            <s:State name="state1" enterState="invalidateSkinState()" />
                            <s:State name="state2" enterState="invalidateSkinState()" />
                        </s:states>
                       
                        <s:Group>
                            <s:Panel id="panel1" title="state1 panel" includeIn="state1"/>
                            <s:Panel left="160" id="panel2" title="state2 panel" includeIn="state2"/>
                            <s:Button left="300" label="toggleState" click="currentState= currentState=='state1' ? 'state2' : 'state1'"/>
                        </s:Group>
                        
                        <s:transitions>
                            <s:Transition fromState="state1" toState="state2" >
                                <s:Parallel duration="500">
                                    <s:Fade target="{panel1}"  /> <!-- hide panel 1 with fade effect -->
                                    <s:Fade target="{panel2}"  /> <!-- make panel 2 visible with fade effect -->
                                </s:Parallel>
                            </s:Transition>
                           
                            <s:Transition fromState="state2" toState="state1" >
                                <s:Parallel duration="500">
                                    <s:Fade target="{panel1}"  /> <!-- make panel 1 visible with fade effect -->
                                    <s:Fade target="{panel2}"  /> <!-- hide panel 2 with fade effect -->
                                </s:Parallel>
                            </s:Transition>
                        </s:transitions>
                       
                    </s:Application>

                    • 7. Re: State transition of excluded object
                      schipmold Level 1

                      Arghh, how stupid of me, i forgot to test that!

                       

                      The project I'm working on has some weird requirements, but the reason for the transitions to be in the skin is to allow them to be managed by whatever CSS file is loaded.

                      The CSS defines the skins for each component and therefor their transitions. That way a theme can be created for each company that uses the system and it will have everything embedded, including different transitions.

                       

                      I don't think there's another way of doing that, is there?

                       

                      If the transitions can't be in the skin then so be it, no problem I'll just figure out another way of making it as customizable as possible.

                       

                      Thanks a lot for checking though and sorry for wasting your time.

                       

                      Skip