View Single Post
  #6 (permalink)  
Old 10-09-2007, 06:41 PM
AndyField AndyField is offline
Member
 
Join Date: May 2004
Posts: 78
Default Re: Creating zip files by using SWFKit Pro

Hi again.

I still cannot quite get this to work.

I have a .zip file with lots of files in it already where I want to add an additional file. I could either recreate the entire .zip file or I could just add a file to the existing one.


Code:
// get 3 files from the resources panel
var savedFile1 = new File(getAdditionalFile("example.swf"));
var savedFile2 = new File(getAdditionalFile("example.js"));
var savedFile3 = new File(getAdditionalFile("example.html"));

// fileLoad or Save?
// In the examples it shows fileOpen, but that doesn't make sense
var filename = Dialogs.fileSave("Zip files(*.zip)|*.zip|", "zip");

if (filename) {

// Generating .zip file
// creates a new zip file to get a handle

  var handle = new Object;
	handle.value = 0;

// create zip and add files
	zipCreateFile(handle.value, filename, savedFile1);
    zipAddFile(handle.value, filename, savedFile2);	
    zipAddFile(handle.value, filename, savedFile3);

	// closes and saves the zip file
	zipClose(handle.value); 
}
I cannot get this to work though. ???

What would be even better would be to have a standard .zip file from the resources panel that I just add two files to and then create the new .zip file.
__________________
:)
Reply With Quote