Images are still uploading distorted
hi guys,
i here while ago same problem. i'd thought fixed it, all did substitute 1 problem another. i'm distorted uploaded image issue. believe i've located offended code cannot figure out how adjust uploaded image isn't distorted.
basically happens end user can submit own images/pictures loyalty/gift card. once card has been submitted can minor adjustments, i.e. resize, skew, , rotate. once happy, can add text well. once happy can hit submit button , new card face uploaded our server.
problem is, when user sort of adjusting image; rotating and/or skewing, "print preview" image (which goes printer) distorted. cannot figure out how make distortion stop. there here can help?
below snippet of code believe causing problem ...
[code]
/*****[ functions: processes final upload ]*****************************************/
function doupload(e:mouseevent):void {
deselect();
//if (checkstep2()) {
step3.btnfinalize.mouseenabled = false;
step3.btnback.mouseenabled = false;
var jpgencoder:jpgencoder = new jpgencoder(100); //create encoder set img quality
var srcfinal:bitmapdata = new bitmapdata(1813,1129);
var srcpreview:bitmapdata = new bitmapdata(435,271);
srcpreview.draw(gcpreview); //write movieclip bitmap data object
// clear printer movie clip.
while (toprinter.numchildren > 0) {
toprinter.removechildat(0);
}
gcpreview.mcpattern.scalex = 1;
gcpreview.mcpattern.scaley = 1;
gcpreview.mcframe.scalex = 1;
gcpreview.mcframe.scaley = 1;
gcpreview.mctext.width = gcpreview.mctext.width * scalewidth;
gcpreview.mctext.height = gcpreview.mctext.height * scaleheight;
gcpreview.mcupload.width = gcpreview.mcupload.width * scalewidth;
gcpreview.mcupload.height = gcpreview.mcupload.height * scaleheight;
gcpreview.mctext.x = gcpreview.mctext.x * scalewidth;
gcpreview.mctext.y = gcpreview.mctext.y * scaleheight;
gcpreview.mcupload.x = gcpreview.mcupload.x * scalewidth;
gcpreview.mcupload.y = gcpreview.mcupload.y * scaleheight;
gcpreview.mcframe.x = gcpreview.mcframe.x * scalewidth;
gcpreview.mcframe.y = gcpreview.mcframe.y * scaleheight;
// add background pattern, uploaded image, , text.
toprinter.addchild(gcpreview.mcpattern);
toprinter.addchild(gcpreview.mcupload);
toprinter.addchild(gcpreview.mcframe);
toprinter.addchild(gcpreview.mctext);
if(gcpreview.mcd_logo.visible){
gcpreview.mcd_logo.x = gcpreview.mcd_logo.x * scalewidth;
gcpreview.mcd_logo.y = gcpreview.mcd_logo.y * scaleheight;
gcpreview.mcd_logo.width = gcpreview.mcd_logo.width * scalewidth;
gcpreview.mcd_logo.height = gcpreview.mcd_logo.height * scaleheight;
toprinter.addchild(gcpreview.mcd_logo);
}else{
gcpreview.mccafe_logo.x = gcpreview.mccafe_logo.x * scalewidth;
gcpreview.mccafe_logo.y = gcpreview.mccafe_logo.y * scaleheight;
gcpreview.mccafe_logo.width = gcpreview.mccafe_logo.width * scalewidth;
gcpreview.mccafe_logo.height = gcpreview.mccafe_logo.height * scaleheight;
toprinter.addchild(gcpreview.mccafe_logo);
}
//addclipping(); // adds square logos go send printer.
srcfinal.draw(toprinter); // write movieclip bitmap data object
var jpgfinal:bytearray = jpgencoder.encode(srcfinal); // create bytearray store jpeg stream
var jpgpreview:bytearray = jpgencoder.encode(srcpreview);
upload(jpgfinal, jpgpreview);
//}
}
[/code]
you should letting user manipulate movieclip or sprite loader attached. when manipulations completed create bitmapdata , use transform matrix duplicate movieclip/sprite transformations.
you should create stage sized bitmapdata object use draw method
More discussions in ActionScript 3
adobe
Comments
Post a Comment