Wednesday, October 27, 2010

Bitmap Smoothing with ActionScript 3

Bitmaps Actionscript 3

Controls whether or not the bitmap is smoothed when scaled. The above images were scaled at 300%. When you load an image using a loader and would like to increase the size of the image, use the smoothing property. If true, the bitmap is smoothed when scaled. If false, the bitmap is not smoothed when scaled.

The Code

import flash.display.Loader;
import flash.display.Bitmap;

var myPicLoader:Loader = new Loader();
myPicLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
myPicLoader.load(new URLRequest("http://www.theflashstudio.net/images/flashstudioSmooth.jpg"));

var myPicLoader2:Loader = new Loader();
myPicLoader2.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete2);
myPicLoader2.load(new URLRequest("http://www.theflashstudio.net/images/flashstudioSmooth.jpg"));

function onComplete(event:Event):void {
var bitmapImage:Bitmap = event.target.content;
bitmapImage.smoothing = true; // APPLY SMOOTHING
myPicLoader.x = 52; // X Placement
myPicLoader.y = 25; // Y Placement
myPicLoader.height = 200;
myPicLoader.width = 168;
addChild(myPicLoader);
}

function onComplete2(event:Event):void {
var bitmapImage2:Bitmap = event.target.content;
bitmapImage2.smoothing = false; // APPLY SMOOTHING
myPicLoader2.x = 307; // X Placement
myPicLoader2.y = 25; // Y Placement
myPicLoader2.height = 200;
myPicLoader2.width = 168;
addChild(myPicLoader2);
}

 

Using Video Smoothing Blog Post

1 comment:

  1. Thanks... Clipping Expert Asia is the best photo editing services provider company around the world.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...