02-12-2011 10:58 AM
Hello, I have an Image object and have set its content using setImage(). When I resize the image by doing Image.width = 500 (for example) the actual image object will resize but the content inside of it will remain the same. Calling setImage everytime I resize the image isn't very efficient as it isn't an instant processing calling setImage. So how would I accomplish resizing the image content every time the image is resized?
02-12-2011 12:05 PM
02-12-2011 02:38 PM
scaleX and scaleY resize the Image but do not resize the BitmapData within it. Is there a way to change the containment of the bitmap data? How would I access the bitmap data in the first place since there is no option like Image.bitmapdata?
02-12-2011 04:21 PM
Depending on what you're trying to accomplish, you may be going about it wrong. Actually resizing the data repeatedly would be Very Bad. You'd get all kinds of nasty artifacts building up from the repeated transformation. Generally you would want to do something like scaling a copy of the original, and only if and when it was time to write out the final modified data (assuming you want to do that) would you actually apply a resize operation to modify the data, once.
None of that helps you find out how to get to the BitmapData from an Image, of course... but for that I'd simply recommend you retrieve BitmapData in the first place, and use that to do the setImage(). Keep a copy of it around for later, and you're all set.
02-21-2011 01:34 PM - edited 02-21-2011 01:49 PM
I figured out how to get the Bitmap but how would I use scaleX and scaleY to scale the image according to its containers (The actual image object) width & height?
Also is there a more efficient method since I will be using this a lot so that the user can resize an image with his/her mouse?
I have resolved the scale issue by rereading another thread I started.
My question about the efficiency still stands though.