Skip to main content
Participant
June 18, 2021
Answered

Automatic export all fla(as3) files to mp4

  • June 18, 2021
  • 9 replies
  • 1899 views

Hi,

In my project, I have multiple fla files and want to export all my files to mp4 automatically. Is there any way to export files automatically.

    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer JoãoCésar17023019

    Hi.

     

    This is script should be able to open up all FLAs within a folder, export all main timeline frames as a uncompressed .mov and then open up Adobe Media Encoder so you can convert the generated video files to .mp4.

     

    JSFL:

     

    function main()
    {
        var uri = fl.browseForFolderURL("select", "Select the folder containing the FLAs.");
        var files = FLfile.listFolder(uri + "/*.fla", "Files.");
    	var total = files.length;
    	var dom, i, source;	
    	
        try
        {
              for (i = 0; i < total; i++)
              {
    			  source = uri + "/" + files[i];
                  fl.openDocument(source);
    			  dom = fl.getDocumentDOM();
    			  dom.exportVideo(source.slice(0, -4) + ".mov", true, false, true, dom.timelines[0].frameCount);
                  dom.close(false);
              }
        }
        catch(error)
        {
              fl.trace(files);
              fl.trace(error);
              fl.trace("___________");
        }
    }
    
    main();

     

     

    Please visit this link for more info about the exportVideo method so you can customize it according to your needs.

     

    I hope this helps.

     

    Regards,

    JC

    9 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    June 18, 2021

    Hi.

     

    This is script should be able to open up all FLAs within a folder, export all main timeline frames as a uncompressed .mov and then open up Adobe Media Encoder so you can convert the generated video files to .mp4.

     

    JSFL:

     

    function main()
    {
        var uri = fl.browseForFolderURL("select", "Select the folder containing the FLAs.");
        var files = FLfile.listFolder(uri + "/*.fla", "Files.");
    	var total = files.length;
    	var dom, i, source;	
    	
        try
        {
              for (i = 0; i < total; i++)
              {
    			  source = uri + "/" + files[i];
                  fl.openDocument(source);
    			  dom = fl.getDocumentDOM();
    			  dom.exportVideo(source.slice(0, -4) + ".mov", true, false, true, dom.timelines[0].frameCount);
                  dom.close(false);
              }
        }
        catch(error)
        {
              fl.trace(files);
              fl.trace(error);
              fl.trace("___________");
        }
    }
    
    main();

     

     

    Please visit this link for more info about the exportVideo method so you can customize it according to your needs.

     

    I hope this helps.

     

    Regards,

    JC

    _keyframer
    Community Expert
    Community Expert
    June 19, 2021

    So cool JC!

    Animator and content creator for Animate CC
    JoãoCésar17023019
    Community Expert
    Community Expert
    June 19, 2021

    Thanks a lot, Chris!

    _keyframer
    Community Expert
    Community Expert
    June 18, 2021
    _keyframer
    Community Expert
    Community Expert
    June 18, 2021

    Animate doesn't have a native script that allows auto-export. There may be a way to write a script on the OS side to open and export FLA files in a folder perhaps. How many FLA files do you have?

    Animator and content creator for Animate CC