5 Replies Latest reply on Sep 18, 2008 12:07 PM by Newsgroup_User

    Abort loading in Image ItemRenderer when dataprovider changes

    CampSafari
      Hi, i am buidling an image list based on the TileList and a custom itemRenderer which contains an Image component,
      but when the dataProvider of the list changes and items are refreshed the "old" images, when not finished loading, are still loading in the background...how can i abort the loading of these?
      which event is fired when a itemRenderer is removed or destroyed?
        • 1. Re: Abort loading in Image ItemRenderer when dataprovider changes
          EvolvedDSM
          itemRenderers are tricky. I just did an app recently that used an itemRenderer that changes a button to text when the button was clicked. By clicking the button, it added data to my dataProvider. When that data was created, it removed the button and produced a label.

          Anyway, if that didn't relate to your problem, we can still make it work. Have you tried using an EventListener(ResultEvent.RESULT) on your dataProvider? You could just assign a function to it that refreshes your dataProvider or the images being created.

          myDataProvider.addEventListener(ResultEvent.RESULT,updateTL);

          private function updateTL():void{
          myDataProvider.refresh();
          }

          Or however you want to refresh your TL (tileList).
          • 2. Re: Abort loading in Image ItemRenderer when dataprovider changes
            CampSafari Level 1
            yes this could work but i want to avoid adding eventlisteners to the dataprovider in the renderer itself for every item, because the view should be strongly separated from the model (where the dataprovider is) and should not have to know about the model events and logic.

            • 3. Re: Abort loading in Image ItemRenderer when dataprovider changes
              Level 7

              "berndbreit" <webforumsuser@macromedia.com> wrote in message
              news:gatdpg$nct$1@forums.macromedia.com...
              > Hi, i am buidling an image list based on the TileList and a custom
              > itemRenderer
              > which contains an Image component,
              > but when the dataProvider of the list changes and items are refreshed the
              > "old" images, when not finished loading, are still loading in the
              > background...how can i abort the loading of these?
              > which event is fired when a itemRenderer is removed or destroyed?

              Could you be more specific about what you are seeing? It sounds to me like
              you might actually just be having a recycling problem.

              HTH;

              Amy


              • 4. Re: Abort loading in Image ItemRenderer when dataprovider changes
                CampSafari Level 1
                i have a tile list, with itemrenderers containing images and when the dataProvider changes and some images have not finished loading they are not removed nor unloaded the just keep loading until completion.
                • 5. Re: Abort loading in Image ItemRenderer when dataprovider changes
                  Level 7

                  "berndbreit" <webforumsuser@macromedia.com> wrote in message
                  news:gau6pr$nke$1@forums.macromedia.com...
                  >i have a tile list, with itemrenderers containing images and when the
                  > dataProvider changes and some images have not finished loading they are
                  > not
                  > removed nor unloaded the just keep loading until completion.

                  If you add a button that changes the dataProvider well _after_ all images
                  are loaded, does the problem go away?