2 Replies Latest reply on Nov 9, 2008 5:48 AM by Newsgroup_User

    mx:Repeater

    wkolcz Level 1
      Can anyone tell me what I am doing wrong here or am I using the wrong component. I am trying to loop through all my project notes vertically. They are all showing 'correctly' but just all on one line. I am trying to have them appear one under another (hopefully with a scroll bar).

      <mx:Repeater id="myRep" dataProvider="{notesData}">
      <mx:VBox width="100%" height="100%">
      <mx:Label id="whoBy" text="{notesData.getItemAt(myRep.currentIndex).name} - {notesData.getItemAt(myRep.currentIndex).dateAdded}" />
      <mx:Text text="{notesData.getItemAt(myRep.currentIndex).note}" width="50%" />
      </mx:VBox>
      </mx:Repeater>
        • 1. Re: mx:Repeater
          alice_data Level 1
          HI,

          If you would like to have the elements be displayed line by line, do

          <mx:VBox width="100%" height="100%">
          <mx:Repeater id="myRep" dataProvider="{notesData}">
          <mx:Label id="whoBy" text="{notesData.getItemAt(myRep.currentIndex).name} - {notesData.getItemAt(myRep.currentIndex).dateAdded}" />
          <mx:Text text="{notesData.getItemAt(myRep.currentIndex).note}" width="50%" />
          </mx:Repeater>
          </mx:VBox>

          This way your elements would be treated one element after another instead of chunking them into one single huge item.

          Hope this helps.

          Aiice
          • 2. Re: mx:Repeater
            Level 7

            "projectproofing" <webforumsuser@macromedia.com> wrote in message
            news:gf4tue$a6$1@forums.macromedia.com...
            > Can anyone tell me what I am doing wrong here or am I using the wrong
            > component. I am trying to loop through all my project notes vertically.
            > They
            > are all showing 'correctly' but just all on one line. I am trying to have
            > them
            > appear one under another (hopefully with a scroll bar).
            >
            > <mx:Repeater id="myRep" dataProvider="{notesData}">
            > <mx:VBox width="100%" height="100%">
            > <mx:Label id="whoBy"
            > text="{notesData.getItemAt(myRep.currentIndex).name} -
            > {notesData.getItemAt(myRep.currentIndex).dateAdded}" />
            > <mx:Text text="{notesData.getItemAt(myRep.currentIndex).note}" width="50%"
            > />
            > </mx:VBox>
            > </mx:Repeater>

            Alice is right, but also you may want to consider using a less verbose
            syntax:

            <mx:VBox width="100%" height="100%">
            <mx:Repeater id="myRep" dataProvider="{notesData}">
            <mx:Label id="whoBy" text="{myRep.currentItem.name -
            myRep.currentItem.dateAdded}" />
            <mx:Text text="{myRep.currentItem.note}" width="50%" />
            </mx:Repeater>
            </mx:VBox>