jslf change publish settings

a little jsfl snippet to publish the swf with a new name

will add it to google code at some point as a file and with some other bits, but it will have to do till then

note: the code is a mash up of stuff I have found online and my own bits

var tempFileURI = "file:///C|/profile.xml";				//a temp file to store settings in
document.exportPublishProfile(tempFileURI);			//store the buggers
var settings =;				//read em in
var backupSettings = settings;					//backup incase you only want a temp publish settings alteration
var ffnOpen = "<flashFileName>";
var ffnClose = "</flashFileName>";
var ffnOpenLength = ffnOpen.length;
var swfName = settings.substring(settings.indexOf(ffnOpen)+ffnOpenLength,settings.indexOf(ffnClose));
var newSwfName = prompt("update swf name", swfName);	//doesnt have to come from input box could be hardcoded or derived
if (newSwfName == null || newSwfName.length == 0)
	newSwfName = swfName;
settings = settings.split(swfName).join(newSwfName);	//replace the name	
//voodoo section to make it work
var from = settings.indexOf("<defaultNames>");
var to = settings.indexOf("</defaultNames>");
var delta = settings.substring(from, to);
settings = settings.split(delta).join("<defaultNames>0");
from = settings.indexOf("<flashDefaultName>");
to = settings.indexOf("</flashDefaultName>");
delta = settings.substring(from, to);
settings = settings.split(delta).join("<flashDefaultName>0");
//end voodoo
FLfile.write(tempFileURI, settings);					//write it back to the file now its updated
document.importPublishProfile(tempFileURI);			//import that biatchhh
document.testMovie();							//optional publish