package {
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	
	/**
	 * ...
	 * @author netgrind
	 */
	public class FaceSprite extends Sprite {
		
		public var data:BitmapData;
		public var faceData:BitmapData;
		public var face:Bitmap;
		public var size:int = 0;
		
		public function FaceSprite(bitmap:Bitmap, size:int = 100 ) {
			super();
			this.size = size;
			data = bitmap.bitmapData;
			faceData = new BitmapData(size, data.height, true, 0);
			face = new Bitmap(faceData,"auto",true);
			addChild(face);
			face.x = -face.width * 0.5;
			face.y = -face.height * 0.5;
			displayFrame(0);
		}
		
		public function displayFrame(i:int):void {
			faceData.copyPixels(data, new Rectangle(size*i, 0, size, data.height), new Point());
		}
		
	}
	
}