     }
 
     private function createLoaders():void {
-      for (var i:uint = 0; i < maxImages; i++) {
+      for (var i:uint = 0; i < MAX_IMAGES; i++) {
         var loader:MJPGImage = new MJPGImage();
         loader.cacheAsBitmap = false;
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);

    }

    public function getChildren():Array {
       var children:Array = [];
       for (var i:uint = 0; i < this.numChildren; i++) {
        children.push(this.getChildAt(i));
       }
       return children;
    }

    public function load(image:ByteArray):void {
      if (imgBuf.length >= maxImages + 3) {
        imgBuf.shift();
      }
      imgBuf.push({ data: image });

      if (!playing) {
        playing = true;
        for each (var loader:MJPGImage in getChildren()) {
          loader.data.inQue = true;
          idleQue.push(loader);
        }
      }

      if (idleQue.length > 0) {
        loadImage(idleQue.shift(), imgBuf.shift());
      }
    }


    }

    public function getFps():Number {
      if (timestamps.length < 2) { return 0; }
      var loadTimesSum:Number = 0;
      for (var i:uint = 1; i < timestamps.length; i++) {
        loadTimesSum += timestamps[i] - timestamps[i - 1];
      }
      return 1000 * (timestamps.length - 1) / loadTimesSum;
    }

  }
