i made a flash desktop application that requires the user to save a file to his computer, in this case i have a lot of images and i want the user to save them on his computer, the images are on a folder called "imgs", i'm using one image in this case, i tried to do the following using FZip:
import deng.fzip.*;
import flash.filesystem.*;
import flash.filesystem.File;
//retrieve the image from the "imgs" folder
var myfile:File = new File("C:/Users/User/Desktop/zip/imgs/myimage.png");
//zipping the image
var zip:FZip = new FZip();
zip.addFile(myfile.name, myfile.data);
//saving the image to the user's desktop
var ba:ByteArray = new ByteArray();
zip.serialize(ba);
ba.position = 0;
var finalZIP:File = File.desktopDirectory.resolvePath("myfile.zip");
var fs:FileStream = new FileStream();
fs.open(finalZIP, FileMode.WRITE);
fs.writeBytes(ba);
fs.close();
the result is a zip file in the desktop, named "myfile.zip", with and image named "myimage.png", but when i unzip the file the image is empty, i tried to do the same with a text file, the text file is there zipped, but with nothing inside it. Any idea what might cause this problem?