sharing small pieces of rocks or jewels I find on the way

Archive for March, 2008

Smoothing image loaded in Flash

In our company we have been working on t-shirt customization tool for long time. Here people can upload their own picture and it is placed on t-shirt. They can rotate, resize, move and many other features. Infact all features t-shirt tools now-a-days offer.

Normally the image gets pixelated like normal html. So, whether the image is bigger or smaller always it’s little crippled. One of our client asked to make it smoother. Then I found Flash supports bitmap smoothing. After working on the code, I have made a small code snippet which will make any movieclip loading smooth image.

Just paste in the movieclip actionscript

onClipEvent(load)
{
        if(this.getBytesLoaded()>100)
        {
            import flash.display.*;
            var bitmap:BitmapData = new BitmapData(_width,_height);
            bitmap.draw(this);
            this._quality = “BEST”;
            this.attachBitmap(bitmap,1,”auto”,true);
        }
}

Interesting, huh?