7 Replies Latest reply on Feb 22, 2010 7:03 AM by kglad

    Loading images...

    FaBritze

      I'm creating a new gallery, where I carry the information (location of the pictures, title, id ...) through an XML, I created a class for it and so far so sure. But to add the images I'm using a command for making the process very heavy, I know another way to make the loading of images ... Below is the snippet I'm using to load the images:

       

       

      for (var i:Number = 0; i < evt.currentTarget.getXml.children().length(); i++) {

           for (var j:Number = 1; j <= 24; j++) {

                var urlRequest:URLRequest;

                urlRequest = new URLRequest(urlImage);

       

                trace(urlRequest.url);

                loader = new Loader();

                loader.load(urlRequest);

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

           }

      }

       

      private function onCompleteLoader(evt:Event):void {

           evt.currentTarget.removeEventListener("COMPLETE",onCompleteLoader);

       

           imagens[0] = evt.currentTarget.content;

           dispatchEvent(new Event(Event.COMPLETE));

      }