4 Replies Latest reply on Aug 24, 2010 8:32 AM by 330cic

    How can I swap components in my app?


      I have an application (Flex3)  that contains a canvas.  The canvas contains an HBox with 3 components - call them team1, middleSection and team2.


      team1 and team2 are canvases containing several components inside of them representing 2 sports teams (home and away).


      middleSection contains a button called "swap" that simply swaps team1 and team2 (like football teams change ends at the end of each quarter).


      team1 and team2 are both instances of a custom Team component that extends Canvas and contains a panel, data grid, and other goodies.


      Unfortunately, I can't for the life of me get them to swap.


      I had hoped to do something like this:


      private function doSwapTeams(event:MouseEvent):void {




           var temp:Team = team1;

           team1 = team2;

           team2 = temp;



      But no luck.


      I tried getting the array of children and swapping that...again, no luck.  I tried invalidating - no luck.


      Any ideas?