5 Replies Latest reply on Mar 5, 2009 10:57 PM by squareSquirrel

    Wraping content in Flex

    squareSquirrel
      Hello,
      Simple question (I think): is there any way to wrap content generated with a Repeater?
      Imagine a grid of images (don't want to use a tilelist or grid because images have same height but different widths)
      generated by a Repeater.
      I just want images to move to the next row as they reach the maximum width of the container.
      I've seen someone do this by calculating x/y coordinates for each item. I don't really like that idea...

      Help appreciated.
      Thank you,
      Cristi
        • 1. Re: Wraping content in Flex
          robbyk87 Level 1
          TileList should do the trick perhaps - give it a specific width value and height 100% then itemRenderer="myIconRenderer"

          myIconRenderer component should be a Box with just and <mx:Image id="pic"> and a bit of script to serve the pic.source maybe an array or something.
          • 2. Re: Wraping content in Flex
            squareSquirrel Level 1
            Hi,
            What I understand is that TileList is like an HTML table. You can have columns and rows but a column (or row) is always the same width (or height). I'm pretty sure you can't get around that.

            Imagine my setup like this:
            [____] [__] [__] [___] [____] [__]
            [__] [___] [_____] [__] [___]
            [___] [___] [___] [_____]

            (those are supposed to be images, different widths but same height)

            Thank you,
            • 3. Re: Wraping content in Flex
              robbyk87 Level 1
              ah sorry i've got you now. You might have to do a calculation? Get the width of your container, get the width of all images and store in an array, calculate the array by processing one after the other and storing that width in a variable with the condition that the added widths do not exceed the container max width - if they do exceed then you create a display object (HBox) with the images added into it and add that as a child to your container. However this removes the repeater event because you are basically making a custom repeater through AS.
              • 4. Re: Wraping content in Flex
                Level 7
                Look for the Flex FlowBox container. You an probably modify it to do what
                you want.
                "squareSquirrel" <webforumsuser@macromedia.com> wrote in message
                news:gooh3k$bju$1@forums.macromedia.com...
                > Hello,
                > Simple question (I think): is there any way to wrap content generated with
                > a
                > Repeater?
                > Imagine a grid of images (don't want to use a tilelist or grid because
                > images
                > have same height but different widths)
                > generated by a Repeater.
                > I just want images to move to the next row as they reach the maximum width
                > of
                > the container.
                > I've seen someone do this by calculating x/y coordinates for each item. I
                > don't really like that idea...
                >
                > Help appreciated.
                > Thank you,
                > Cristi
                >


                • 5. Re: Wraping content in Flex
                  squareSquirrel Level 1
                  Thank you robbyk87 but that what I was trying to avoid... Calculations...
                  Actually, Amy's solution is EXACTLY what I wanted. The flexlib's FlowContainer is perfect for the job.
                  Already tried it on my current setup and worked out of the box :)
                  There's some other interesting stuff there.
                  Thank you so much!