Flex Bug: smoothBitmapContent doesn’t work for reloaded images

SmoothBitmapContent works only for first loaded image. After changing the source of an image smoothing becomes false.
The Solution: attach a loading complete listener and change the smooth property of the loaded image by yourself.

	<mx :Script>
		< ![CDATA[
 
			/**
			 * Flex Bug: after reloading the image smoothing is false. smoothBitmapContent works only for first loaded image.
			 * Solution: set the smooting property of the 
			 */
			private function onImageLoaded():void
			{
				log.trace("onImageLoaded()");
 
				//-- doesn't work 
				//preview.smoothBitmapContent = true; 
 
				// works
				var bmp:Bitmap = preview.content as Bitmap;
				if( bmp ) bmp.smoothing = true;
			}
 
		]]>
	</mx>
 
	<mx :Image id="preview" width="200" height="100" smoothBitmapContent="true" source="{ _previewPath }" complete="onImageLoaded()" />

Schlagwörter:

Leave a Reply