1 Reply Latest reply on Jun 3, 2007 4:00 PM by peterent

    When switching between states, the states are not drawn properly... please help!

    aq2sllik
      Hi guys I have an application here:
      http://sllik.homeip.net/playfb/flexchat.mxml
      the source is here:
      http://sllik.homeip.net/playfb/bin/srcview/source/flexchat.html

      When you click on the "Hide" button at the bottom right it goes to a different state, then when you click on the rectangle on the right it should go back to the initial state... it kinda does but the components are not randared properly.

      Any ideas? thanks...
        • 1. Re: When switching between states, the states are not drawn properly... please help!
          peterent Level 2
          Your Hide Chat Rooms state has a lot going on and sequencing those things is tricky - restoring them can be even harder as you are seeing.

          The trick with states and transitions is to be as simple as possible. However, when you want to return to your base state you have undo what you've done. You see where you have those <mx:RemoveChild> and <mx:AddChild> tags in your Hide Chat Rooms state? When you restore to your base state, Flex is going to use AddChild to put back the one(s) removed with RemoveChild and use RemoveChild to remove the ones added with AddChild. So your transition should reflect that including AddChildAction and RemoveChildAction tags in the Sequence of events in the transition from Hide Chat Rooms to the base state.

          You'll have to experiment a little to insert them into the sequence, but it is generally in the reverse order you have them in the first state.