Transition won't affect a component with children...:|

Hello all, I had a problem with transitions which I isolated into a very simple 
case:
I have a VBox with a text label and a button.
When user clicks the button, the current state changes into a new state in 
which new component is added to my VBox which I expect to grow smoothly.
This new component is just a canvas with a label.

The child canvas is added but it appears without a transition.
This is when the component is defined in a separate mxml file, BUT, if I define 
the exact same component, inline in the state definition, it works just as I 
expeted. I then went to the component mxml and deleted the label leaving it to 
be a simple canvas and it works. it seems that whatever is added to the 
component when it's defined in a separate file will disable the transition.

This is the main mxml:

<?xml version="1.0" encoding="utf-8"?>


    <mx:states>
        <mx:State name="myState">
            <mx:AddChild relativeTo="{container}">
            <!--
                <mx:Canvas backgroundColor="0x678080">
                    <mx:Label text="I'm the new component, did I came in 
smoothly ?" />
                </mx:Canvas> 
            -->
                <local:MyComp />
            </mx:AddChild>
        </mx:State>
    </mx:states>
    
    <mx:transitions>
        <mx:Transition fromState="*" toState="*">
            <mx:Sequence target="{container}">
                <mx:Resize />
            </mx:Sequence>
        </mx:Transition>
    </mx:transitions>
    
    <mx:VBox id="container" backgroundColor="0xFF0000">
        <mx:Label text="Some text goes here" />
        <mx:Button label="click me to add new component" click="currentState = 
'myState'" />
    </mx:VBox>

</mx:Application>


And this is the very-simple component:

<?xml version="1.0" encoding="utf-8"?>

    <mx:Label text="I'm the new component, did I came in smoothly ?" />
</mx:Canvas>


I attached the 2 files.
Notice that if you comment the component definition in the state and uncomment 
the same exact inline-component definition , it works great.



Thanks a lot !

Almog Kurtser





      
____________________________________________________________________________________
Get easy, one-click access to your favorites. 
Make Yahoo! your homepage.
http://www.yahoo.com/r/hs 

Attachment: TransitionBug.mxml
Description: Binary data

Attachment: MyComp.mxml
Description: Binary data

Reply via email to