No you can do it at runtime but you must make a bitmap from the png first. Take a look at the code below or see a live example here http://www.chill-mode.com/flex_examples/smoothing/Smoothing.html view source is enabled.
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="zoomer.play([image]);"> <mx:Script> <![CDATA[ private function smoothImage(event:Event):void { //Create a new bitmap with smoothing from the original image var smoothData:BitmapData = new BitmapData(image.width, image.height, true, 0x00FFFFFF); smoothData.draw(image.content as Bitmap); var smoothImage:Bitmap = new Bitmap(smoothData, "auto", true); image.source = smoothImage; } ]]> </mx:Script> <mx:Sequence id="zoomer" repeatCount="0"> <mx:Zoom zoomHeightFrom="1.0" zoomHeightTo="2.0" zoomWidthFrom="1.0" zoomWidthTo="2.0" duration="3000"/> <mx:Zoom zoomHeightFrom="2.0" zoomHeightTo="1.0" zoomWidthFrom="2.0" zoomWidthTo="1.0" duration="3000"/> </mx:Sequence> <mx:Button label="smooth image" click="smoothImage(event);" /> <mx:Image id="image" source="@Embed(source='tranparent.png')" x="319.5" y="173"/> </mx:Application> --- In flexcoders@yahoogroups.com, Greg Hess <flexeff...@...> wrote: > > Thanks very much for your reply. > > I suspected smoothing too and tried using a SmothImage class we use for > resizing external JPG's, however it did not help. > > If I understand correctly the smoothing of the PNG would need to be > performed when creating the graphic, not at runtime > in Flash, is this correct? > > > > On Fri, Oct 2, 2009 at 1:04 PM, ag_rcuren <robert.vancuren...@...>wrote: > > > > > > > Smoothing should solve your problem. I have done a very similar thing and > > by smoothing the images it fixed the pixelization. > > > > You may have to create a new Bitmap from the image and set that Bitmap's > > smoothing to true. I do not believe you can directly smooth a .png image I > > think smoothing only applies to bitmaps. > > > > > > --- In flexcoders@yahoogroups.com <flexcoders%40yahoogroups.com>, Greg > > Hess <flexeffect@> wrote: > > > > > > Hi All, > > > > > > I am trying to apply a roll over/out resize or zoom effect on a Button > > > with graphical skins. When the mouse is over the image I want it to > > > grow and shrink on exit(currently using roll over/out events). My png > > > skins are transparent and have round shapes, when I resize/zoom up or > > > down the image quality is poor and shows pixelization on the round > > > edges. > > > > > > I have tried swapping the images (large vs small) when the effects end > > > but it feels clunky. I have tried using a straight image vs a button > > > component but get the same result. I also tried just specifying the > > > large image as the over, down skins and applying a resize effect to > > > the button but it also is clunky. Cache as bitmap, smoothing, maintain > > > aspect ratio, scale content seem to have no effect on my resizing of > > > these transparent pngs. > > > > > > Not sure what I am doing wrong, any help is much appreciated. > > > > > > Thanks, > > > > > > Greg > > > > > > > > > >