2 Replies Latest reply on Aug 8, 2009 12:35 AM by niff111

    dynamically choosing viewStack element


      I have 3 components: A, B, C

      A is parent of B and C. I'm passing a string from component B to C and it works. But in component C I want set this string to selectedChild property of my viewStack (which is in C). This string is dynamically changing (B is dispatching it) and I want my viewStack.selectedChild to change too. Is there any way to do that?


      Thanks a lot.


        • 1. Re: dynamically choosing viewStack element
          Gregory Lafrance Level 6

          If this post answered your question or helped, please mark it as such.


          This code surely does not exactly replicate your situation, but it should either lead to a solution or be of great help:


          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
           horizontalAlign="center" verticalAlign="middle">
            <mx:VBox id="B" width="500" height="500" backgroundColor="0x0000FF"
             horizontalAlign="center" verticalAlign="middle">
              <mx:Label id="oneB" text="one"/>
              <mx:VBox id="C" width="450" height="450" backgroundColor="0xFF0000"
               horizontalAlign="center" verticalAlign="middle">
                  <mx:Label id="oneC" text="{oneB.text}"/>
                  <mx:LinkBar dataProvider="viewStack"/>
               <mx:ViewStack id="viewStack">
                <mx:VBox label="one" width="300" height="300" backgroundColor="0x00FF00">
                 <mx:Label text="One Label"/>
                <mx:VBox label="two" width="300" height="300" backgroundColor="0xCCCCCC">
                 <mx:Label text="Two Label"/>
                <mx:VBox label="three" width="300" height="300" backgroundColor="0xFFFFFF">
                 <mx:Label text="Three Label"/>
          • 2. Re: dynamically choosing viewStack element
            niff111 Level 1

            No, it's not what i was looking for, but thanks for the reply:)

            I've resolved it in different way.