Revision: 17916
Updated Code
at October 20, 2009 02:31 by chrisaiv
Updated Code
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);
bitmap.draw(mc);
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
// Sample code
createEmptyMovieClip("mc1", getNextHighestDepth());
mc1.createEmptyMovieClip("mc", mc1.getNextHighestDepth());
//mc1.mc.loadMovie("flash.png");
loadBitmapSmoothed("http://digitallibrary.usc.edu/assetserver/controller/rendition/VIT-001470/page-1", mc1.mc);
mc1.onEnterFrame = function() {
// Ugly, but we are not using a MovieClipLoader for the unsmoothed case
mc1.mc._x = -150;
mc1.mc._y = -230;
mc1._x = Stage.width / 2;
mc1._y = Stage.height / 2;
mc1._rotation += 0.5;
}
Revision: 17915
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 16, 2009 17:28 by chrisaiv
Initial Code
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);
bitmap.draw(mc);
};
// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}
// Sample code
createEmptyMovieClip("mc1", getNextHighestDepth());
mc1.createEmptyMovieClip("mc", mc1.getNextHighestDepth());
//mc1.mc.loadMovie("flash.png");
loadBitmapSmoothed("http://digarc.usc.edu/assetserver/controller/rendition/VIT-001470/page-1", mc1.mc);
mc1.onEnterFrame = function() {
// Ugly, but we are not using a MovieClipLoader for the unsmoothed case
mc1.mc._x = -150;
mc1.mc._y = -230;
mc1._x = Stage.width / 2;
mc1._y = Stage.height / 2;
mc1._rotation += 0.5;
}
Initial URL
Initial Description
This is a test to show that when you smooth Bitmaps, you can rotate them beautifully.
Initial Title
AS2: Bitmap Smoother
Initial Tags
Initial Language
ActionScript