In Flash, I have an external image and i loaded that image using a sprite for the user to edit the image.
var bitmapData:BitmapData = Bitmap(event.currentTarget.content).bitmapData;
var bitmap:Bitmap = new Bitmap(bitmapData);
bitmap.smoothing = true;
bitmap.width=500
bitmap.height=300
photoHolder = new Sprite()
photoHolder.addChild(bitmap);
After the edit, i would like to save the same image but with different width and height for example 800x480. In saving the image, i did this.
**var myBitmapData:BitmapData = new BitmapData(photoHolder.width, photoHolder.height);**//photoHolder.width, photoHolder.height
myBitmapData.draw(photoHolder);
THen later save it using FileStream.
private function F_saveImageActions():void{
//get Bimapdata from file
var myBitmapData:BitmapData = selectedFile.photo_bitmapData
//encode, turn into byeArray
var jpgEncoder:JPGEncoder = new JPGEncoder(100);
var imgByteData:ByteArray = jpgEncoder.encode(myBitmapData);
//
var folder:File = File.documentsDirectory.resolvePath("Myproject/myImage.jpg");
imageFileStream = new FileStream();
imageFileStream.addEventListener(Event.CLOSE, FS_imageFileClosed);
imageFileStream.addEventListener(Event.COMPLETE, FS_imageCompleteHandler);
imageFileStream.addEventListener(ProgressEvent.PROGRESS, FS_imageProgressHandler);
imageFileStream.addEventListener(IOErrorEvent.IO_ERROR, FS_imageErrorHandler);
imageFileStream.openAsync(folder, FileMode.UPDATE);
imageFileStream.writeBytes(imgByteData);
} I tried changing the size by editing the bold line above to this.. var myBitmapData:BitmapData = new BitmapData(800,480);
But it didnt work. it had a different outcome than i expected and the quality was affected.. So to be precise here is my question
How do i change the size of an image from a sprite on stage and export it without losing its quality?(AS3)