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

JSFL opening AS2 FLA

Community Beginner ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

During JSFL encoding, this error window comes up when opening FLA produced with AS2 encoding. is there a way to turn this off with JSFL encoding?

 

as2.png

TOPICS
ActionScript , Code , Error , How to

Views

715

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

correct answers 1 Correct answer

Community Expert , Feb 23, 2023 Feb 23, 2023

Hi.

 

Run this before opening the documents:

fl.suppressAlerts = true;

 

I hope it helps.

 

Regards,

JC

Votes

Translate

Translate
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

Hi.

 

Run this before opening the documents:

fl.suppressAlerts = true;

 

I hope it helps.

 

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
Community Beginner ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

thx bro working

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 ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

You're welcome.

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 Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Dear João,

I'm writing a script automating the import process of files to the library where I already have an item with a same name. The alert

Funtom_0-1678274244302.png

 

keeps popping up even with the suppression line. The code is below. I read from Flash Scripting Reference that the third paremeter, showDialog is:
A Boolean value that specifies whether to display the Import dialog box. Specifying true displays the import dialog. If you specify false, the function imports the file using specifications set in the Preferences dialog. The default is true.

I haven't been able to find that Preference, since the Sync Settings tab is missing in my Animate.  Any suggestions?

 

Many thanks in advance!

Funtom

fl.suppressAlerts = true;
var doc = fl.getDocumentDOM();
var fileURL = "file:///Macintosh%20HD/Users/(usr)/Documents/_test/images/bnr_980x400.png";
doc.importFile(fileURL, true, false, 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
Contributor ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

If I understand you correctly, then try inserting all the library elements into a folder with a random name. Then there will be no name conflict and the pop-up window will not appear

Multoman_0-1678292182641.png

 

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 Beginner ,
Mar 08, 2023 Mar 08, 2023

Copy link to clipboard

Copied

Thanks for the idea. In my process the idea is to update old library items with new ones. The Animate document acts as a template and each library item has a certain animation connected to it. I'm running the jsfl as part of an applescript folder action in mac. I wrote a (n ugly) workaround for now.

tell application "Finder" to set fl_scriptPath to ("MacHD:Users:" & usr & ":Documents:animExp.jsfl" as string)
with timeout of 1 second
  try
    tell application "Adobe Animate 2023"
      activate
      open alias fl_scriptPath
    end tell
    on error eMes number eNum
    tell application "System Events"
      tell application process "Adobe Animate 2023"
	    keystroke tab
	    keystroke tab
	    keystroke space
	    keystroke return
      end tell
    end tell
  end try
end timeout

 

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Hi.

 

Sorry for the late reply.

 

The only solution I could think of is:
- To check if the an item with the same name exists in the root of the Library;

- If so, move this item to a temp folder;
- Then import the new image;
- Move the new image to the temp folder because in this way we can overpass the replace prompt;
- Move the image back to the root;
- Delete the temp folder.

 

And there's no need to suppress the alerts.

Import to the Library Without Prompt JSFL:

 

var imageName = "pexels-darina-belonogova-9160592.jpg";
var tempFolderNamePrefix = "temp_";
var dom, lib, imageExists;
var imageURL; // in this example, the image is in the same folder where this script is located

function main()
{
	dom = fl.getDocumentDOM();
	
	if (!dom)
	{
		alert("Please open up a FLA first.");
		return;
	}

	imageURL = fl.scriptURI.replace(fl.scriptURI.split("/").pop(), "") + imageName;

	if (!fl.fileExists(imageURL))
	{
		alert("The image URL is wrong or the image doesn't exist.");
		return;
	}

	lib = dom.library;
	imageExists = lib.itemExists(imageName)

	if (imageExists)
	{
		var tempFolderName = tempFolderNamePrefix + Date.now();
		lib.newFolder(tempFolderName);
		lib.moveToFolder(tempFolderName, imageName, true);
	}

	dom.importFile(imageURL, true, false, false);

	if (imageExists)
	{
		lib.moveToFolder(tempFolderName, imageName, true);
		lib.moveToFolder("", tempFolderName + "/" + imageName, true);
		lib.deleteItem(tempFolderName);
	}
}

main();

 

 

Source / file / JSFL / download:
https://bit.ly/3T396fm

 

Usage (one of the following):
- Double click the script file;

- Or drag and drop the script file over the Animate IDE;

- Or place it in the Commands folder to run it.

 

To run the code from the commands folder, place it in one of the following paths:

 

macOS:

 

/Users/<USER>/Library/Application Support/Adobe/<ANIMATE_VERSION>/<LANGUAGE>/Configuration/Commands

 

E.g.:

 

/Users/johndoe/Library/Application Support/Adobe/Animate 2023/en_US/Configuration/Commands

 

 

Windows:

 

<BOOT_DEVICE>\Users\<USER>\AppData\Local\Adobe\Animate <ANIMATE_VERSION>\<LANGUAGE>\Configuration\Commands

 

E.g.:

 

C:\Users\johndoe\AppData\Local\Adobe\Animate 2021\en_US\Configuration\Commands

 

 

Then you can run the command in Animate by going to Commands > Your Command Name.

 

I hope it helps and please let me know if there's something to fix or improve.

 

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
Community Beginner ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

João,

Many thanks! I'll try to implement your solution and get back to you if necessary. And your reply time was really good! 🙂

Cheers!

Funtom

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Fantastic! You're welcome!

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 Beginner ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

Works like a charm!

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 ,
Mar 09, 2023 Mar 09, 2023

Copy link to clipboard

Copied

LATEST

Awesome! I'm really glad it was helpful to you. Have a nice day!

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