         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onImageError);
         this.addChild(loader);
       }
+      stage.addEventListener(Event.RESIZE, resizeListener);
+    }
+
+    private function resizeListener(e:Event):void {
+      for each (var loader:MJPGImage in getChildren())
+      {
+        scaleAndPosition(loader);
+      }
     }
 
     public function getChildren():Array
     {
        var children:Array = [];
-
        for (var i:uint = 0; i < this.numChildren; i++)
+       {
         children.push(this.getChildAt(i));
-
+       }
        return children;
     }
 


      if (idleQue.length > 0)
      {
        loader = idleQue.shift() as MJPGImage;
        loadImage(loader, imgBuf.shift());
      }
    }

    private function onLoadComplete(event:Event):void
    {
      if (!playing)
      {
        return;
      }

      var arr:Array = getChildren();
      var loader:MJPGImage = event.currentTarget.loader as MJPGImage;
      var bitmap:Bitmap = event.currentTarget.content;
      if (bitmap != null)
      {
        bitmap.smoothing = true;
      }
      loader.data.loading = false;

      // Scale to fit stage
      var loaderAspectRatio:Number = loader.width / loader.height;
      var stageAspectRatio:Number = stage.stageWidth / stage.stageHeight;

      loader.height *= scale;

      // Center on stage
      loader.x = (stage.stageWidth - loader.width) / 2;
      loader.y = (stage.stageHeight - loader.height) / 2;
    }

    private function onLoadComplete(event:Event):void
    {
      if (!playing)
      {
        return;
      }

      var arr:Array = getChildren();
      var loader:MJPGImage = event.currentTarget.loader as MJPGImage;
      var bitmap:Bitmap = event.currentTarget.content;
      if (bitmap != null)
      {
        bitmap.smoothing = true;
      }
      loader.data.loading = false;

      scaleAndPosition(loader);

      var curTime:Number = new Date().getTime();
      decTime += curTime - loader.data.loadTime;
