PDA

View Full Version : saveDocument troubles


tdoublea
12-28-2004, 07:44 PM
hello.
i'm trying save an open document with a new name in the same location.
the only problem i am running into is that it will only save with the new name if the open document has been changed (anything to get that asterik next to the file in the API)
is the saveDocument method only used for unsaved current documents? if so what methos should i be using to save an open document with a new name without have the saveAs window appear?

here's the script:

var newName = "my_new_doc";
var my_doc = fl.getDocumentDOM();
my_doc.selectNone();
//get its path
var tStr = my_doc.path;
//get rid of the \'s
var tArr = tStr.split("\\");
var len = tArr.length
tStr = tArr.join("/");
var newStr = tStr.slice(0, tStr.lastIndexOf("/"));
newStr += "/";
newStr += newName;
var newDoc = "file:///"+newStr+".fla";
fl.saveDocument(newDoc);


thanks in advance.
-t

hangalot
12-29-2004, 11:20 AM
try exporting the swf, that seems to give the file a changed attribute

tdoublea
12-29-2004, 01:26 PM
thanks for getting back to me hangalot!
the publish first works nicely, but it's not very clean. i want to be able to open the fla file and save it with a new name. i can only seem to get that to work if the fla is changed somehow. let me give a little example of what i'm doing:

i have an fla with a bunch of components in its library. I made a WindowsSWF that has a checklist of those components. when you check off the components you would like to use for a new project, they are assembled on the stage in accordance to which ones chosen, blah blah blah.
all this stuff works, but i would like to save the fla with a new name first, close th original fla, then assemble stuff on the new one, so the original fla will kind of act as a springboard template- nothing will change in it.

i can get it to work with FLfile.copy and save the copy with a new name, close the original fla- but i want it to be able to work on all versions of 7, not just ellipses.

is the saveDocument method the correct method to use if nothing has been changed? i can't seem to get around this.
thanks again

-t

hangalot
12-29-2004, 05:57 PM
there is a saveas method as well, and i am not certain if it has the same limitation. i have had some problems with those methods as well, and did bypass it with flFile so i am not the best person to ask ;)

check out the extending flash mailing list on flashguru.co.uk there might be an answer floating in there somewhere. (use google to search the archives)
also guy watson (flashguru) and burak (asvguy) did a mxp to give filesystem access pre 7.2 but it only works on windows machines (nt,2000,xp), but u can force a install of that mxp.

tdoublea
12-30-2004, 12:21 AM
darn. i've tried all the variations. that flfile is a god-send... but it's got to work on both mac and pc and 7 up. i've checked around and there's a wealth of knowledge of how to save, but basically only when things have been changed in the file.
i've got some other ideas, but they're just not pretty...

thanks again.

-t