Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function saveBigPhoto(e:MouseEvent = null):void
- {
- var loader:Loader = new Loader();
- var li:LoaderInfo = loader.contentLoaderInfo;
- loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
- loader.load(new URLRequest(bigPhoto.src));
- function onComplete(e:Event):void
- {
- loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onComplete);
- li.addEventListener(Event.COMPLETE, handler_bytesComplete);
- loader.loadBytes(li.bytes);
- }
- function handler_bytesComplete(e:Event):void
- {
- li.removeEventListener(Event.COMPLETE, handler_bytesComplete);
- var src:DisplayObject = li.content as DisplayObject;
- var jpgSource:BitmapData = new BitmapData(src.width, src.height, true, 0x00000000);
- try
- {
- jpgSource.draw(src);
- }
- catch (err:Error)
- {
- }
- var jpgEncoder:JPGEncoder = new JPGEncoder(90);
- jpgStream = jpgEncoder.encode(jpgSource);
- // var fileName:String = "znakomstva_plus_" + new Date().time.toFixed(0) + ".jpg";
- fileName = "znakomstva_plus_" + curUID + "_" + curAID + "_" + curPhoto + ".jpg";
- saveFile = new FileReference;
- saveFile.addEventListener(Event.COMPLETE, saveCompleteHandler);
- saveFile.addEventListener(IOErrorEvent.IO_ERROR, saveIOErrorHandler);
- TweenLite.to(btnSave, 0.3, {alpha: 1});
- btnSave.visible = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement