Well you could take a look at marjnivessers (prob didnt spell that right) ImageLoader. That class smooths a loaded image. But the one I have is as2. Try googling ImageLoader and see if he has an as3 version. If anything, you could get the logistics from it and apply.
HTH

Karl

Sent from losPhone

On Jun 3, 2009, at 5:18 AM, "allandt bik-elliott (thefieldcomic.com)" <[email protected] > wrote:

Hey guys

I'm having a problem with using smoothing on my loaded bitmap images with
AS3 and I was wondering if you could help, please?

Here is my code:
[code]
       private function sendImageLoadEvent(e:Event):void
       {
           var nCurImg:Number         = _arImageArray.length;

           var bmp:Bitmap             = e.target.content as Bitmap;
           bmp.smoothing = true;

           // create scale / offset
           var bmp_xscale:Number     = stage.stageWidth / bmp.width;
           var bmp_yscale:Number     = stage.stageHeight / bmp.height;
var bmp_scale:Number = Math.min(bmp_xscale, bmp_yscale);
           var bmp_scaledWidth:Number         = bmp.width * bmp_scale;
           var bmp_scaledHeight:Number     = bmp.height * bmp_scale;
var bmp_xshift:Number = (stage.stageWidth - bmp_scaledWidth)
/ 2;
           var bmp_yshift:Number     = (stage.stageHeight -
bmp_scaledHeight) / 2;

           var bmpMatrix:Matrix     = new Matrix(bmp_scale, 0, 0,
bmp_scale, bmp_xshift, bmp_yshift);

           var bmpImage:BitmapData = new BitmapData(stage.stageWidth,
stage.stageHeight, false, 0x000000);
           bmpImage.draw(bmp, bmpMatrix, null, null, null, true);
           bmp.bitmapData             = bmpImage;
           bmp.smoothing = true;

           _arImageArray[nCurImg]     = new Sprite();
           _arImageArray[nCurImg].addChild(bmp);
           _sprViewingArea.addChild(_arImageArray[nCurImg]);
       }
[/code]

I saw on grant skinners blog that adding a bitmapData property to a Bitmap object will remove the smoothing property so that is why I'm re- applying the
smoothing to see if that makes a difference

It seems like this is quite a buggy thing to do (based on the amount of unresolved forum hits in google) but i'd like to see if there's a solution.

Could it be the size of the images (ie Is there a maximum size to scale from
/ to / by)? Anything you've learned could be helpful.

Thanks for your help in advance
Alz
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to