topical media & game development
#graphic-flex-image-effects-03-Flex-SmoothingTest.ax
#graphic-flex-image-effects-03-Flex-SmoothingTest.ax
[swf]
[flash]
flex
package {
import flash.display.Bitmap;
import flash.display.PixelSnapping;
[SWF(width=1200, height=600, backgroundColor=0xFFFFFF)]
Shows an image scaled up with smoothing applied and without.
public class @ax-graphic-flex-image-effects-03-Flex-SmoothingTest extends graphic_flex_image_effects_03_Flex_AbstractImageLoader {
Constructor. Sends path to image to load to super class.
public function @ax-graphic-flex-image-effects-03-Flex-SmoothingTest() {
super("graphic-flex-image-effects-assets-brighton.jpg");
}
Scales up and displays two copies of loaded image.
override protected function runPostImageLoad():void {
// first bitmap is not smoothed
var bitmap:Bitmap = new Bitmap(_loadedBitmap.bitmapData);
bitmap.scaleX = bitmap.scaleY = 3;
addChild(bitmap);
// second bitmap is smoothed
bitmap = new Bitmap(_loadedBitmap.bitmapData, PixelSnapping.AUTO, true);
bitmap.scaleX = bitmap.scaleY = 3;
bitmap.x = 600;
addChild(bitmap);
}
}
}
(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.