7 Replies Latest reply on Sep 22, 2008 9:03 AM by Newsgroup_User

    How to Position Nested Repeater Element

    alice_data Level 1
      Hi,

      I am trying to create a mx:Canvas element that has mx:Repeater element inside that loops around the mx:Panel element from external data. After several attempts, I realize that the y attribute is not available in the mx:Panel. If I still would like the function to contain some sort of looping as such in the attached code, how could I have the y attribute be activated so that I can dynamically place elements according to the y value I assigned to in my HTTPService output?

      I welcome any sort of advice on this.

      Alice
        • 1. Re: How to Position Nested Repeater Element
          Level 7

          "alice_data" <webforumsuser@macromedia.com> wrote in message
          news:gb3qad$nl6$1@forums.macromedia.com...
          > Hi,
          >
          > I am trying to create a mx:Canvas element that has mx:Repeater element
          > inside that loops around the mx:Panel element from external data. After
          > several
          > attempts, I realize that the y attribute is not available in the mx:Panel.
          > If I
          > still would like the function to contain some sort of looping as such in
          > the
          > attached code, how could I have the y attribute be activated so that I can
          > dynamically place elements according to the y value I assigned to in my
          > HTTPService output?
          >
          > I welcome any sort of advice on this.
          >
          > Alice
          >
          >
          > <mx:Repeater id="repeater1"
          > dataProvider="{event_abc.lastResult.mydata.arr}">
          > <mx:Panel id="eventRepeater"
          > label="{repeater1.currentItem.label}"
          > y="{repeater1.currentItem.y}" />
          > </mx:Repeater>
          >

          Why not just use a VBox? You might also want to look at constraints.

          But to answer your question, what you're doing should work. Are you sure
          that your dataProvider contains what you think it does?


          • 2. Re: How to Position Nested Repeater Element
            alice_data Level 1
            Hi,

            The information did brought back accurate results, the only problem I was having is that the position of the y attribute did not return the way it should be from the data set. If the y value is 44, it is still at the top of the panel.

            To illustrate, I have a portion of the data.
            The issue with VBox, which what I ask here may be a little off from the topic, isn't the VBox supposedly align the contained elements in a vertical way without specification? If I have individual y attribute values like in the snippet, would this still work?

            Thanks in advance for your help.

            Alice
            • 3. Re: How to Position Nested Repeater Element
              Level 7

              "alice_data" <webforumsuser@macromedia.com> wrote in message
              news:gb49gq$aj9$1@forums.macromedia.com...
              > Hi,
              >
              > The information did brought back accurate results, the only problem I
              > was
              > having is that the position of the y attribute did not return the way it
              > should
              > be from the data set. If the y value is 44, it is still at the top of the
              > panel.
              >
              > To illustrate, I have a portion of the data.
              > The issue with VBox, which what I ask here may be a little off from the
              > topic, isn't the VBox supposedly align the contained elements in a
              > vertical way
              > without specification? If I have individual y attribute values like in the
              > snippet, would this still work?
              >
              > Thanks in advance for your help.
              >
              > Alice
              >
              >
              > <event>
              > <id>1</id>
              > <name>Shop at Goodwill</name>>
              > <y>44</y>
              > </event>

              If you're repeating the panel, the y coordinate should affect the content of
              the panel within the Canvas, not the content of the panel. Could you post
              more of your code, possibly even making a release build with "view source"
              enabled and uploading that somewhere?

              -Amy


              • 4. Re: How to Position Nested Repeater Element
                alice_data Level 1
                Sorry, I should have been more explicit.

                I have a mx:Canvas element with some mx:Label elements followed by the mx:repeater element, one with which contains the panels based on the results from the HTTP.Service The position of the mx:Panel elements are supposed to be aligned with the values of the individual y attributes depending on the constraints. The main issue is that it appears that when I output the result, the y attribute value, despite the fact that it has been proclaimed, do not appear as they are. For example, if the y is 44, it is still on the top of the screen, which is why I am questioning if y attributes are supported in mx:Panel elements or mx:repeater elements, whichever that may go wrong.

                Thanks in advance.

                Alice
                • 5. Re: How to Position Nested Repeater Element
                  Level 7

                  "alice_data" <webforumsuser@macromedia.com> wrote in message
                  news:gb58u1$g6r$1@forums.macromedia.com...
                  > Sorry, I should have been more explicit.
                  >
                  > I have a mx:Canvas element with some mx:Label elements followed by the
                  > mx:repeater element, one with which contains the panels based on the
                  > results
                  > from the HTTP.Service The position of the mx:Panel elements are supposed
                  > to be
                  > aligned with the values of the individual y attributes depending on the
                  > constraints. The main issue is that it appears that when I output the
                  > result,
                  > the y attribute value, despite the fact that it has been proclaimed, do
                  > not
                  > appear as they are. For example, if the y is 44, it is still on the top of
                  > the
                  > screen, which is why I am questioning if y attributes are supported in
                  > mx:Panel
                  > elements or mx:repeater elements, whichever that may go wrong.
                  >
                  > Thanks in advance.
                  >
                  > Alice
                  >
                  > <mx:Canvas id="my_test">
                  > <mx:Label text="A" y="24"/>
                  > <mx:Label text="B" y="34"/>
                  > <mx:Label text="C" y="44"/>
                  > <mx:Label text="D" y="54"/>
                  > <mx:Repeater id="repeater1"
                  > dataProvider="{event_abc.lastResult.mydata.arr}">
                  > <mx:Panel id="eventRepeater"
                  > label="{repeater1.currentItem.label}"
                  > y="{repeater1.currentItem.y}" />
                  > </mx:Repeater>
                  > </mx:Canvas>

                  This works exactly as expected, so maybe you can look and see how it's
                  different from yours:

                  <?xml version="1.0" encoding="utf-8"?>

                  <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

                  <mx:XML id="repeaterSource" xmlns="">

                  <panels>

                  <panel>

                  <label>Panel 1</label>

                  <y>0</y>

                  </panel>

                  <panel>

                  <label>Panel 2</label>

                  <y>100</y>

                  </panel>

                  <panel>

                  <label>Panel 3</label>

                  <y>200</y>

                  </panel>

                  <panel>

                  <label>Panel 4</label>

                  <y>300</y>

                  </panel>

                  </panels>

                  </mx:XML>

                  <mx:Canvas>

                  <mx:Repeater id="panelRepeater"
                  dataProvider="{repeaterSource.children()}">

                  <mx:Panel id="repeatedPanel"
                  title="{panelRepeater.currentItem.label}"

                  x="20" y="{panelRepeater.currentItem.y}" />

                  </mx:Repeater>

                  </mx:Canvas>

                  </mx:Application>


                  • 6. Re: How to Position Nested Repeater Element
                    alice_data Level 1
                    Thanks, Amy.
                    Using your example as a template, I found out that mine has too many nested elements that appears to disrupt the way things should be laid out.

                    Everything is working out now, thanks again.
                    • 7. Re: How to Position Nested Repeater Element
                      Level 7

                      "alice_data" <webforumsuser@macromedia.com> wrote in message
                      news:gb89g1$4kg$1@forums.macromedia.com...
                      > Thanks, Amy.
                      > Using your example as a template, I found out that mine has too many
                      > nested
                      > elements that appears to disrupt the way things should be laid out.
                      >
                      > Everything is working out now, thanks again.

                      You're welcome :-)