1 Reply Latest reply on Jan 10, 2012 10:04 AM by jumroo101

    Access BorderContainer (BC) inside  NavigatorContent and add elements to the BC

    jumroo101

      Thanks for helping.

       

      When the user clicks on tab1, I want to add some custom components and buttons

      in the BorderContainer b.   The NavigatorContent has a show handler. How do I

      add an element to the Bordercontainer b in the show_handler. 

       

      What is the mechanism to extract the BorderContainer b  and add an element to

      this container in the show_handler?

       

      In the following showHandler b is null. Upon seeing in the debugger there

      is a ContentGroup inside the currentTarget in the event and

      and then the trail ran cold.

       

      Anyhelp is appreciated.

       

      Here is the code

       

      <fx:Script>

      protected function navigatorContent_showHandler(event:FlexEvent):void {

          var nc:NavigatorContent = NavigatorContent( event.currentTarget);

          var bc:BorderContent= BorderContainer(nc.getByName("b")); 

          b.addElement(socsusobj_1);

          Alert.show(event.toString(),"Error");

      }

       

      </fx:Script>

       

      <s:Scroller id="scrollerHome" includeIn="home" x="3" y="8" width="933" height="584">

        <s:VGroup width="100%" height="100%">

          <s:TabBar dataProvider="{viewstackHome}"/>

            <mx:ViewStack id="viewstackHome" width="936" height="553">

              <s:NavigatorContent id="a" width="100%" height="100%" label="Tab 1" show="show_handler">

                 <s:BorderContainer id="b" x="0" y="27" minWidth="0"

                    minHeight="0" borderColor="#808080" borderWeight="4" cornerRadius="5" >

                          <s:layout>

                            <s:TileLayout paddingBottom="5" paddingLeft="5" paddingRight="5"

                            paddingTop="10"/>

                          </s:layout>

                  .

                  .

                  .

              </s:NAvigatorContent>

              <s:NavigatorContent width="100%" height="100%" label="Tab 2">

              </s:NavigatorContent>

                .

                .

                .

            </mx:ViewStack>

          </s:TabBar>

        </s:VGroup>

      </s:Scroller>