5 Replies Latest reply on May 21, 2010 6:58 AM by srinivas72

    Images disappears in tilelist when scrolling and dragging

    srinivas72

      Hi,

      I am using vbox as itemrenderer for tilelist.Inside vbox image component is used.I am creating image source  using bytearrays.The images are loaded dynamically into tilelist perfectly.But when I scroll the tilelist or drag the images from tilelist then the images which are dynamically created are disappeared.But the images which are loaded at application creationcomplete event ,those images are not getting any problem means they are visible when I scroll or drag them.Why this is happening and how to make the images visible all times.Any help is appreciated.

      With thanks,

      Srinivas

        • 1. Re: Images disappears in tilelist when scrolling and dragging
          David_F57 Level 5

          hi,

           

          When you use a bytearray to store an image make sure it is a new array not a pointer

           

          ba: ByteArray = imagedata only points to an image so refreshing the tile list will cuase the issues you see.

           

          this will fix it

          var ba: ByteArray = new ByteArray();

          
          ba = imagedata;
           ImageCollection.addItem(ba);  <=== ImageCollection(arrayCollection) is the dataprovider
          
          David

          • 2. Re: Images disappears in tilelist when scrolling and dragging
            srinivas72 Level 1

            Hi David,

            Thanks for reply.I am loading the image as follows:

            *

             

            var* fr:FileReference=e.target as FileReference;

            *

             

            var* loader:Loader=new Loader();

             

            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImageLoaded);

             

            loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,

            ioErrorHandler);

             

            loader.loadBytes(fr.data);

            *

             

            private* function ioErrorHandler(event:IOErrorEvent):void {

             

            trace("ioErrorHandler: " + event);

             

            }

             

            private function onImageLoaded(e:Event):void{

             

            var bmp:Bitmap=LoaderInfo(e.target).content as Bitmap;

             

            uploadedImagesAC.addItemAt(bmp,0);

             

            }

            uploadedImagesAC is an arrayCollection used as tilelist

            dataprovider.tilelist itemrender is vbox which contains the image

            control.the image is loaded initally fine.but when i scroll the tilelist or

            drag the image it disappers from tilelist.

            How to resove this issue.

            with thanks,

            Srinivas

            • 3. Re: Images disappears in tilelist when scrolling and dragging
              David_F57 Level 5

              hi,

               

              As I said if you point to the data rather than store it in the array you are going to have problems, currently you are creating a pointer to loader content.

               

              http://gumbo.flashhub.net/pagedrop/  source included.

               

              If you follow the code for storing the image data into the array rather than storing a pointer in the array you will not get the problems you are having.

               

              The above example is probably close to what you are doing, it also includes an item renderer.

               

              David.

              • 4. Re: Images disappears in tilelist when scrolling and dragging
                srinivas72 Level 1

                Hi David,

                Thank you very much for your help.I got it as you suggested me.I changed the

                filereference.data to new ByteArray object.It's working fine.You saved my

                time as I spent days to get it.Thanks once again.

                 

                With Regards

                Srinivas

                • 5. Re: Images disappears in tilelist when scrolling and dragging
                  srinivas72 Level 1

                  Hi David,

                  When I drag the tilelist itemrender image which is bytearray is not droped

                  to the canvas stage.If i pass url to the image using loader it is

                  working.But problem is  with bytearray image only.I am working with flex

                  3.If i convert the bytearray into bitmap it is droped but disappears from

                  tilelist. How to do this.

                  With thanks

                  Srinivas