Copy link to clipboard
Copied
Hi!
I need a jsfl command to create a new file from an .fla file that located in my app. Something like this:
fl.createDocument("htmlcanvas", "C:\Program Files (x86)\MyApp\FLATemplates\300x600.fla);
I've searched for a long time but it seems like there aren't any command like this exist.
Any Ideas?
Thank you!!!
Copy link to clipboard
Copied
if that existed it would be in the flfile methods.
Copy link to clipboard
Copied
Hi.
I think a workaround here would be to open the document and then convert it to the format that you want afterwards.
https://github.com/AdobeDocs/developers-animatesdk-docs/blob/master/Document_object/docu6069.md
Regards,
JC
Copy link to clipboard
Copied
Hi!
var fileURI = "file:///C:/Users/...PC_300x600.fla";
var doc = an.openDocument(fileURI);
doc.convertToDoc("", 'htmlcanvas', false);
doc = an.openDocument(fileURI);
doc.close(false);
The code above did open the document then convert it. But it's not the expected behavior since Animate force me to save the new file. I need it to remain unsaved, just like when you use File > New from Template...
Thank you!
Copy link to clipboard
Copied
You need to provide a destination path to the convertToDoc method. Something like this:
var newType = "htmlcanvas";
var fileURI = FLfile.platformPathToURI("<platform_path_to_the_doc>");
var doc = an.openDocument(fileURI);
var destinationURI = doc.pathURI.slice(0, doc.pathURI.lastIndexOf("/")) + "/" + doc.name.slice(0, -4) + "_" + newType;
doc.convertToDoc(destinationURI, newType, false);