Mike Orth – Booya!

Flex, Actionscript

Archive for the 'Visual' Category

Targeting the Right Component for Transitions

When doing any state transitions, you have to be sure to specify the intended target. For instance, recently I was debugging some client code to see why a fade wasn’t working. It turned out that the target was set to the parent group instead of each specific component.

    <s:transitions>
        <s:Transition fromState="*" toState="*">

<!--    INCORRECT way of doing it:
           Don't target the parent container-->

        <s:Fade target="{[content]}"/>
       
            <!--CORRECT: target each specific component-->
            <s:Fade targets="{[pageOne, pageTwo]}"/>
        </s:Transition>
    </s:transitions>

<s:Group id="content">
       <local:PageOne id="pageOne" includeIn="one"/>
       <local:PageTwo id="pageTwo" includeIn="two"/>
</s:Group>

In this case, you need to target pageOne and pageTwo, NOT content.

No comments

Google Tracking Code