import mx.core.BitmapAsset;
private function compare():void {
var bmpd1:BitmapData = new BitmapData(img1.width, img1.height);
var bmpd2:BitmapData = new BitmapData(img2.width, img2.height);
bmpd1.draw(img1)
bmpd2.draw(img2);
var diff:BitmapData = bmpd2.compare(bmpd1) as BitmapData;
var bitmapAsset:BitmapAsset = new BitmapAsset(diff);
img3.source = bitmapAsset;
}