1 Reply Latest reply on Dec 10, 2008 6:20 PM by Newsgroup_User

    Nested repeaters with custom component

    Ethan Kurtz Level 1
      I have a pair of repeaters (first repeater is for a question, nested repeater is for answer choices). The inner repeater contains a custom component. Inside this component, there is either a checkbox, radio button, text box, or combobox, based on the type of the question that is passed into the custom component.

      My question is, how do I access a property of the custom component. Here is what I have in the main app file, along with the checkbox portion of the custom component. I've tried several ways to display the attributes associated with the custom components, but I'm obviously referencing it wrong:


      inside the main application file
      ---------------------------------------------
      <mx:Repeater id="questionList" dataProvider="{questionsArray}">
      <mx:Canvas width="100%" height="100%">
      <mx:VBox width="100%" height="100%" id="answerList">
      <mx:Repeater id="answerChoices" dataProvider="{buildAnswers(questionList.currentIndex)}">
      <custom:answerComp textBoxText="{answerChoices.currentItem.answer}" cState="{questionList.currentItem.answerType}" comboData="{questionList.currentItem.answerData}"/>
      </mx:Repeater>
      </mx:VBox>
      </mx:Canvas>
      </mx:Repeater>

      <mx:Button x="183" y="366" label="Q1" click="Alert.show(answerComp[0][0].answerText.text);"/>


      custom component
      -------------------------
      <mx:states>
      <mx:State name="check">
      <mx:AddChild position="lastChild">
      <mx:CheckBox x="10" y="5" id="answerCB"/>
      </mx:AddChild>
      </mx:State>
      </mx:states>
      <mx:TextArea borderStyle="none" wordWrap="true" selectable="false" editable="false" x="32" y="5" width="426" height="33" alpha="0" id="answerText" text="{textBoxText}"/>


      I need to be able to see if the checkbox, etc has been checked, and if so, be able to grab the value of the text next to the checkbox for data collection (quiz/survey)

      I'm sure I'm missing something easy....