topical media & game development
#graphic-flex-image-effects-04-Flex-CompareTest.ax
#graphic-flex-image-effects-04-Flex-CompareTest.ax
[swf]
[flash]
flex
package {
import flash.display.Bitmap;
import flash.display.BitmapData;
[SWF(width=1200, height=600, backgroundColor=0x000000)]
Demonstrates how two images can be combines by using BitmapDta's compare() method.
public class @ax-graphic-flex-image-effects-04-Flex-CompareTest extends graphic_flex_image_effects_04_Flex_DualImageTest {
Called after two images have been loaded by super class.
This creates a third image using compare() with loaded images.
override protected function operateOnImages():void {
var bitmap0:Bitmap = getChildAt(0) as Bitmap;
var bitmap1:Bitmap = getChildAt(1) as Bitmap;
var comparedData:Object = bitmap0.bitmapData.compare(bitmap1.bitmapData);
// compare() can return either bitmap data or a number
if (comparedData is BitmapData) {
var bitmap:Bitmap = new Bitmap(comparedData as BitmapData);
addChild(bitmap);
// place to the right of loaded images
bitmap.x = bitmap1.x + bitmap1.width;
}
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.