• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

JSFL create a new file from a template file

Explorer ,
Aug 19, 2024 Aug 19, 2024

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!!!

Views

179

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2024 Aug 19, 2024

Copy link to clipboard

Copied

if that existed it would be in the flfile methods.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 19, 2024 Aug 19, 2024

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 19, 2024 Aug 19, 2024

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2024 Aug 20, 2024

Copy link to clipboard

Copied

LATEST

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);

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines