1 Reply Latest reply on Jan 21, 2011 1:04 PM by Flex harUI

    Moving a component between States

    broconne

      I am fairly new to flex, so I apologize if this is an obvious question.  I have searched the forums, played with my code for several hours, checked my resource material and still can't seem to come up with a workable solution.

       

      I have a  VBox with 20 or so <mx:Image> components.  I read some data from a web service and based on that data I select one of those images.  At that point I want to change states using the "currentState=" method.  I wont all of the other objects in this state but that single selected object to go away as I transition states - during the transition I want to take that object and add it to a different container object that is visible in the new state.  Essentially, I want the appearance of this to be that an object was selected, the rest of the objects fade away and then this object is added to a new container and the object gracefully moves to the location in the new container.

       

      I have tried several approaches and none of them seem to work.

       

        (1) I have tried having this image already in a container in the new state and doing a move transition.

        (2) I have tried using states.push() to add the new state to the selected object.

        (3) I have tried to set the X and Y of the object in the new state to the X and Y of the old state and then move it manually to the new location.  That doesn't seem to work as the X and Y are relative to the container.

       

       

       

      Any ideas are appreciated?