2 Replies Latest reply on Jun 5, 2012 12:42 AM by paule82

    Access BorderContainer in NavigatorContent

    paule82

      Hi,

       

      I have the following (simplified) structure:

       

      <s:NavigatorContent id="profileContent" label="{detailsProfile.label}" width="100%" height="100%">
                      <s:BorderContainer id="bprofileContent" name="bprofileContent" width="100%" height="100%" cornerRadius="3" borderWeight="1" dropShadowVisible="true">
                          <detailsmodify:MusicServiceDetailsProfile id="detailsProfile" isOverrideListNecessary="false"
                                                                    readOnly="{_isReadOnly}"/>
                      </s:BorderContainer>
                  </s:NavigatorContent>
      

       

      How can I access the BorderContainer or even better the UI component (MusicServiceDetailsProfile)? I tried different ways:

       

       

      profileContent.getChildByName("...") -> name of BorderContainer or UI component returns null
      profileContent.contentGroup.getChildByName("...") -> name of BorderContainer or UI component returns null
      
      var borderContainer:BorderContainer = navigatorContent.getElementAt(0) as BorderContainer; -> IndexOutOfBoundsException
      

       

       

      Does anybody know how to acces one of the two nested components?

       

      Thanks a lot in advance!!

        • 1. Re: Access BorderContainer in NavigatorContent
          Matt LeGrand

          Hey Paul,

           

          You're on the right track.  The contentGroup is a spark Group.  So use the getElementAt method and you've got it.  Code should look like this:

           

          var bc:BorderContainer = profileContent.contentGroup.getElementAt(0) as BorderContainer;

          var ui:UIComponent = bc.getElementAt(0) as UIComponent;  // or this could be MusicServiceDetailsProfile

           

          // And you could use this to set a style or something cooler.

          bc.setStyle('backgroundColor', 0x00FF00);

           

          Hope this helps,

          Matt

          • 2. Re: Access BorderContainer in NavigatorContent
            paule82 Level 1

            Hi Matt,

             

            thanks for your response.

             

            But unfortunately I already tried this and I get the following exception:

             

            [Fault] exception, information=RangeError: Index 0 is out of range.

            at spark.components::Group/checkForRangeError()

            at spark.components::Group/getElementAt()

             

            It can't be so difficult to get the nested elements but I can't figure out how to do it ...