I’ve been using the bitmapData class to make my dynamically loaded and resized images smooth. The problem is when my application window is maximised then shrunk back down the bitmapData class adds a black edge to the outside of my images, altering the actual dimensions of the image, which makes the entire algorithm used to centre the image useless. I spent hours trying to fix this but have no clue. Does anyone here know how to fix this problem?
public function resize(width, height) {
_imageWidth = width;
_imageHeight = height;
if (_scale == true) {
if(_imageHeight > mcImage._height or _imageWidth < mcImage._width){
mcImage._height = _imageHeight;
mcImage._xscale = mcImage._yscale;
}
if(_imageWidth > mcImage._width or _imageHeight < mcImage._height){
mcImage._width = _imageWidth;
mcImage._yscale = mcImage._xscale;
}
}
else {
mcImage._width = _imageWidth;
mcImage._height = _imageHeight;
}
mcImage._x = center(_imageWidth, mcImage._width);
mcImage._y = center(_imageHeight, mcImage._height);
var bitmap:BitmapData = new BitmapData(mcImage._width, mcImage._height, true, 0x000000);
mcImage.attachBitmap(bitmap, mcImage.getNextHighestDepth(),"auto", true);
bitmap.draw(mcImage);
}