If I rotate an image 90 degrees in a container, then set visibility
and includeInLayout for that container to false, then set those back
to true, the image is now outside of the container.  This is using Flex 2.

I've made a sample app that shows this problem, but you'll have to add
an image named "triangle.png" for it to work.  For me this is simply a
10x10 png picture of a triangle (used for a disclosable view).

To reproduce the problem:
1. click on the image to rotate it
3. toggle the view to the second view
4. toggle the view back to the first view

Code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="vertical">
        <mx:VBox borderStyle="solid" width="100" height="40">
                <mx:HBox id="firstBox" width="100%" height="100%">
                        <mx:Image source="@Embed('/triangle.png')" 
id="rotateTarget"
click="rotateMe()"/>
                        <mx:Text text="first"/>
                </mx:HBox>
                <mx:HBox id="secondBox" visible="false" includeInLayout="false"
width="100%" height="100%">
                        <mx:Text text="second"/>
                </mx:HBox>
        </mx:VBox>
        <mx:Button click="toggleVisibility()" label="swap view"/>
        
        <mx:Script>
                <![CDATA[
                        import mx.effects.Rotate;
                        private var _rotated:Boolean = false;
                        
                        private function rotateMe():void
                        {
                                var rotateEffect:Rotate = new Rotate();
                                rotateEffect.duration = 1;
                                
                                if (_rotated)
                                {
                                        rotateEffect.angleFrom = 90;
                                        rotateEffect.angleTo = 0;
                                }
                                else
                                {
                                        rotateEffect.angleFrom = 0;
                                        rotateEffect.angleTo = 90;
                                }
                                
                                _rotated = !_rotated;
                                rotateEffect.play([rotateTarget]);
                                
                        }
                        
                        private function toggleVisibility():void
                        {
                                firstBox.visible = !firstBox.visible;
                                firstBox.includeInLayout = 
!firstBox.includeInLayout;
                                secondBox.visible = !secondBox.visible;
                                secondBox.includeInLayout = 
!secondBox.includeInLayout;
                        }
                ]]>
        </mx:Script>
</mx:Application>

Reply via email to