Simple way to smooth the external loaded picture in Flash
[ 2007-05-09 19:25:06 | Author: liuhuan ]
Very simple but useful trick to smooth the picture loaded from outside in flash.
The core idea is to use attachBitmap method to smooth the image.
Comments Feed: http://www.liuhuan.com/blog/feed.asp?q=comment&id=763
The core idea is to use attachBitmap method to smooth the image.
Quote
stop();
function loadMovieClipExternal(externalTarget, targetRoot, loadingP) {
var MCLoader = new MovieClipLoader();
var MCListener = new Object();
MCListener.onLoadInit = function(target) {
target.replaceWithBitmap = function(mc) {
var _mc1 = grabBitmap(mc);
mc.attachBitmap(_mc1, 1, "auto", true);
};
target.replaceWithBitmap(target);
target._rotation = 50;
};
MCLoader.addListener(MCListener);
MCLoader.loadClip(externalTarget, targetRoot);
}
function grabBitmap(mc) {
var _mc = new flash.display.BitmapData(mc._width, mc._height, true);
_mc.draw(mc);
return (_mc);
}
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
loadMovieClipExternal("images/01.jpg", container);
function loadMovieClipExternal(externalTarget, targetRoot, loadingP) {
var MCLoader = new MovieClipLoader();
var MCListener = new Object();
MCListener.onLoadInit = function(target) {
target.replaceWithBitmap = function(mc) {
var _mc1 = grabBitmap(mc);
mc.attachBitmap(_mc1, 1, "auto", true);
};
target.replaceWithBitmap(target);
target._rotation = 50;
};
MCLoader.addListener(MCListener);
MCLoader.loadClip(externalTarget, targetRoot);
}
function grabBitmap(mc) {
var _mc = new flash.display.BitmapData(mc._width, mc._height, true);
_mc.draw(mc);
return (_mc);
}
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
loadMovieClipExternal("images/01.jpg", container);

There is no comment on this article.
You can't post comment on this article.