5 Replies Latest reply on May 11, 2009 9:26 AM by ScottFriebel

    ByteArray Image in tilelist setting itself to null on scroll event

    daxrik
      Hi, for an R&D stuff
      I am recieving and array of images in ByteArray format. so i m loading those into a loader and then add those in a array collection.
      Later i render them into a Tilelist with a custom renderer which takes the content of the loader into a BItmap object and then to an Image component to display.
      On Click of the images they are rendered in canvas adjacent to the tilelist.

      the Images loads very fine.

      But as i scroll the tilelist, the images start disappearing that is on scrolling down and then up the images which were visible earlier are not available and on click it states as null object reference.

      In as such the contents of the array collection are no more.

      Please help its urgent
        • 1. Re: ByteArray Image in tilelist setting itself to null on scroll event
          Level 7

          "daxrik" <webforumsuser@macromedia.com> wrote in message
          news:gkpn00$4l8$1@forums.macromedia.com...
          > Hi, for an R&D stuff
          > I am recieving and array of images in ByteArray format. so i m loading
          > those
          > into a loader and then add those in a array collection.
          > Later i render them into a Tilelist with a custom renderer which takes the
          > content of the loader into a BItmap object and then to an Image component
          > to
          > display.
          > On Click of the images they are rendered in canvas adjacent to the
          > tilelist.
          >
          > the Images loads very fine.
          >
          > But as i scroll the tilelist, the images start disappearing that is on
          > scrolling down and then up the images which were visible earlier are not
          > available and on click it states as null object reference.
          >
          > In as such the contents of the array collection are no more.
          >
          > Please help its urgent

          Code?


          • 2. Re: ByteArray Image in tilelist setting itself to null on scroll event
            daxrik Level 1
            Thanks for ur reply,
            i think i have cracked it as i had the ByteArray in PNG format so instead of loading them into a loader, i directly passed those to an image control in source. So the task was accomplished.

            But i have a new problem,

            As i am dynamically adding the image into the tilelist, on the item click event i m loading the image into the adjacent canvas but on first click the image is not loaded but on further clicks the image is loaded without any issues. can u please help on this. The code is attached for your reference
            • 3. Re: ByteArray Image in tilelist setting itself to null on scroll event
              Level 7

              "daxrik" <webforumsuser@macromedia.com> wrote in message
              news:gkrnlc$k53$1@forums.macromedia.com...
              > Thanks for ur reply,
              > i think i have cracked it as i had the ByteArray in PNG format so instead
              > of
              > loading them into a loader, i directly passed those to an image control in
              > source. So the task was accomplished.
              >
              > But i have a new problem,
              >
              > As i am dynamically adding the image into the tilelist, on the item click
              > event i m loading the image into the adjacent canvas but on first click
              > the
              > image is not loaded but on further clicks the image is loaded without any
              > issues. can u please help on this. The code is attached for your reference
              >
              > /*
              > this function is called when i click on tilelist item
              > */
              > private function showImage(event:Event):void {
              > img= new Image();
              > img=event.currentTarget.selectedItem;

              Is the selectedItem of the tileList an actual Image control? If so, this
              code would be "stealing" it out of the TileList and then putting it
              somewhere else. I suspect it's not (it should be some kind of data object),
              which kind of makes me wonder why it works on subsequent clicks.

              Is your img variable typed as Image? I would think that you'd be getting an
              implicit coercion error when you try to set it to a data item, or at the
              very least a runtime error. Do you have the debug version of the player
              installed? How are you not seeing the errors this ought to generate?


              • 4. Re: ByteArray Image in tilelist setting itself to null on scroll event
                daxrik Level 1
                Nope the tilelist is provided with an array collection of Image, the item renderer is a composite of a VBox into which i have the label and Image control.

                On item click event i have set the source of the image item in tilelist to data.source in the the code, so i think it should work around.

                img is declared as Image control so it does not throw any error on compile as well as run time.

                Even this thing makes me wonder as of how it could only work after the first click and not on first click.
                • 5. Re: ByteArray Image in tilelist setting itself to null on scroll event
                  ScottFriebel Level 1

                  Hello,

                  Could you describe what you did to avoid the problem of the thumbnails dissapearing from the tilelist after you scrolled? I'm having the same issue with the tilelist I'm using in my application.

                  Thanks,

                  Scott