4 Replies Latest reply on Dec 10, 2008 1:05 PM by Brent Lamborn

    createItemRenderer being called continuously

    Brent Lamborn Level 2
      I have a List control that is behaving very oddly. It's createItemRenderer method is being called continously even with no user interaction. The only time the method is not called is when the List is scrolled all the way down.

      I know it is not logical, but it seems to have just started doing this behavior out of nowhere. I've been working with this particular list for about a day and a half, and it wasn't doing this until now.

      This issue it creates is that the itemRenderer my List is using has an image component whose source is a url to our webservice. Each time the createItemRenderer is called, it hits our web service again, to get the image back again.

      Turning on caching for the image does nothing since it is createItemRenderer that gets called continously, resulting in each itemRenderer being rendered again.

      What I really don't understand is why the behavior stops when the list is scrolled all the way down. Does anyone have any hints or conclusions as to why this might be happening?
        • 1. Re: createItemRenderer being called continuously
          rtalton Level 4
          Do you have any code we can see?
          • 2. Re: createItemRenderer being called continuously
            Brent Lamborn Level 2
            Sure. I am actually overridding the List - so attached is my List class. I was originally overloading TileList hence the name FillerTileList - though it is no longer a TileList. I have have a itemRenderer defined for it if you need to see that, let me know.

            I define it like this in my mxml:

            <mpg:FillerTileList id="fillerList" visible="{!(NoFillersMsg.visible)}"
            columnCount="1" itemRenderer="FillerRenderer" variableRowHeight="true" doubleClickEnabled="true"
            itemDoubleClick="FillerDoubleClick(event)" themeColor="#80C7E6"
            dataProvider="{BookFillers.CategoryFiller}" itemsChangeEffect="{TileListEffect}"
            dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" dragComplete="{myFillersChanges = true}"
            width="100%" height="100%" FillerMarkedDelete="{myFillersChanges = true}" />

            • 3. Re: createItemRenderer being called continuously
              Level 7

              "BrentLamborn" <webforumsuser@macromedia.com> wrote in message
              news:ghmj2m$7vu$1@forums.macromedia.com...
              > Sure. I am actually overridding the List - so attached is my List class. I
              > was
              > originally overloading TileList hence the name FillerTileList - though it
              > is no
              > longer a TileList. I have have a itemRenderer defined for it if you need
              > to see
              > that, let me know.

              When I have problems like this, I set lots of break points and step through
              the code. Usually the source of the problem becomes obvious within a couple
              of hours.


              • 4. createItemRenderer being called continuously
                Brent Lamborn Level 2
                I found the issue - sort of. The problem was with the image control within my itemRenderer - at least the fix was. For some reason just setting the source for the image wasn't enough for it to know what size to draw itself. I had to also set width and height explicitly.

                I had done that already - before this problem existed.

                Then I uploaded a new image, which showed in my List. The image was too big to fit in my hard coded width and height settings. Somehow this caused Flex to try to constantly re-render everthing. That is a bug in Flex if you ask me.

                The reason everything quite updating when the list was scrolled down it because the image I mentioned was no longer visible.

                Basically all I did for now was hard code a larger height value. I still don't understand why the image control doesn't "auto-size:" itself just by specify a source url. The component should pick up those values on it's own.