2 Replies Latest reply on May 20, 2010 4:49 AM by David_F57

    how to collect images in arraycollection

    welcomecan Level 1

      hi

      how to collect images in arraycollection

      regards

      welcome can

        • 1. Re: how to collect images in arraycollection
          BhaskerChari Level 4

          Hi,

           

          Do you want to save the image paths in the ArrayCollection you can do this...

           

          private var acImages:ArrayCollection = new ArrayCollection([{url:"image1.jpg"},{url:"image2.jpg"},{url:"image3.jpg"},{url:"image4.jp g"},{url:"image5.jpg"},{url:"image6.jpg"}]);

           

          If this post answers your question or helps, please kindly mark it as such.

           

          Thanks,

          Bhasker Chari

           

           

           

           

           

           

           

          1 person found this helpful
          • 2. Re: how to collect images in arraycollection
            David_F57 Level 5

            hi,

             

            You can store images in an arraycollection as bytearrays, below is an example of loading images then placing them in an arraycollection so that they can be used in a list

             

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

             

            the part of interest is this

             

                        private function getImage(e:Event): void
                        {
                            fr.removeEventListener(Event.COMPLETE, getImage);
                            if (fr.data.length > 0)
                            {
                                var ba: ByteArray = new ByteArray();
                                ba = fr.data;
                                ImageCollection.addItem(ba);
                            }
                            loopList(ImageLoop);
                        }
            
            on image load (jpg or png) its byte data is put into the arraycollection. In the case of large images you could resize them first before adding the data to the collection.
            David.

            1 person found this helpful