0 Replies Latest reply on Sep 7, 2009 4:59 AM by Piotr Wierzgała

    progressive image loading

    Piotr Wierzgała

      I'm trying to write spherical panorama image viewer. In my application I have a cube which each face is a part of spherical panorama photo. I can't figure out how to load images gradualy. By 'gradually' I mean that image shoud be loaded in low quality first a with loading progress the quality level should increase.

       

      The only solution that came into my mind was to add event listener to loader:

       

      var loader:Loader = new Loader();
      loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,imageLoaderProgressEventHandler);
      var url:URLRequest = new URLRequest("front.jpg");
      loader.load(url);  
      

       

      and replace proper cube face each time the event dispatches:

       

      private function imageLoaderProgressEventHandler(event:Event):void {
           var bitmap:Bitmap = event.target.content;
           var bitmapData:BitmapData = bitmap.bitmapData;
           var frontMaterial:BitmapMaterial = new BitmapMaterial(bitmapData);
           cube.replaceMaterialByName(frontMaterial,"front");
      }
      


      but unfortunately it caused an error (data in event object wasn't enough to display an image).

       

      There are few examples of google street view on this blog: http://google-latlong.blogspot.com/2009/03/street-view-cures-homesick-blues.html

      When you zoom in any panorama you'll see the effect I'm talking about.

       

      Thanks in advance for your help.