Class com.bumpslide.util.ImageUtil

com.bumpslide.util.ImageUtil

Method Index

resizeImage(), resizeRect(), smoothImage(), undoSmoothing()

Method Detail

smoothImage

static function smoothImage(holder_mc:MovieClip, image_mc:MovieClip)

Smooths a dynamically attached JPG When resizing or rotating dynamically attached images, you can now apply smoothing in Flash 8 by taking a snapshot of the image as BitmapData and then attaching that bitmap over the old image

Parameters

holder_mcMovieClip where bitmap will be attached
image_mcMovieClip that will be copied into holder

undoSmoothing

static function undoSmoothing(holder_mc:MovieClip, image_mc:MovieClip)

Undo smoothing applied using the smoothImage function

Parameters

holder_mc
image_mc

resizeRect

static public function resizeRect(original:Rectangle, bounds:Rectangle, allowStretching:Boolean)

Resizes an image or rectangle to fit within a bounding box while preserving aspect ratio. The third parameter is optional. AllowStretching allows the image bounds to be stetched beyond the original size. By default this is off. We use this most often for sizing dynamically loaded JPG's, and we don't want them to be stetched larger Example: var origSize, availableSpace, newSize : Rectangle; origSize = Rectangle.rectOfMovieClip( image_mc ); availableSpace = new Rectangle(0,0,500,300); newSize = ImageUtil.resizeRect( origSize, availableSpace ); image_mc._width = newSize.width; image_mc._yscale = image_mc._xscale;

Parameters

original- image size as a rectangle, max dimensions if allowStetching is left to false
bounds- the target size and/or available space for displaying the image

resizeImage

static public function resizeImage(holder_mc:MovieClip, image_mc:MovieClip, maxWidth:Number, maxHeight:Number, applySmoothing:Boolean, allowStretching:Boolean)

Shortcut to resize an image without messing with rectangles

Parameters

image_mc
maxWidth
maxHeight