AS2 bitmap smoother

12 May
import flash.display.*;

function loadBitmapSmoothed(url:String, target:MovieClip) {
	// Create a movie clip which will contain our unsmoothed bitmap
	var bmc:MovieClip = target.createEmptyMovieClip("bmc",target.getNextHighestDepth());

	// Create a listener which will notify us when the bitmap loaded successfully
	var listener:Object = new Object();
	// Track the target
	listener.tmc = target;
	// If the bitmap loaded successfully we redraw the movie into
	// a BitmapData object and then attach that BitmapData to the target
	// movie clip with the smoothing flag turned on.
	listener.onLoadInit = function(mc:MovieClip) {
		var mc:MovieClip = mc;
		mc._visible = false;
//		mc.forceSmoothing
		var bitmap:BitmapData = new BitmapData(mc._width, mc._height, true);
		this.tmc.attachBitmap(bitmap, this.tmc.getNextHighestDepth(),"auto", true);
	// Do it, load the bitmap now
	var loader:MovieClipLoader = new MovieClipLoader();
	loader.loadClip(url, bmc);

// Sample code

createEmptyMovieClip("mc1", getNextHighestDepth());
mc1.createEmptyMovieClip("mc", mc1.getNextHighestDepth());


mc1.onEnterFrame = function() {
	// Ugly, but we are not using a MovieClipLoader for the unsmoothed case = -150; = -230;
	mc1._x = Stage.width / 2;
	mc1._y = Stage.height / 2;
	mc1._rotation += 0.5;

Read more 
Leave a comment

Posted by on May 12, 2011 in flash


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: