JSFL script to export all pictures in Flash

Source: Internet
Author: User
JSFL refers to Flash JavaScript, a JavaScript script file that is an important tool for extending the Flash IDE.       As a AS3 programmer, learning and mastering the use of JSFL is very important after using JSFL you will be surprised to find that, wow, originally can be so efficient to do flash development. During the AS3 development process, editing the FLA and using it is an important process when a FLA sets the final version.  Mature development often backs up the resources in the finalized version to SVN. This completes the backup and makes it easy to look in the folder directly when you want to use a single picture. Because a FLA often involves a lot of pictures, if rely on a picture of the human to export, and then categorize, save. It is time-consuming, laborious, and prone to omission. Then we want to be able to write a script ourselves, let the code help us implement this process.
Here is a complete example of a JSFL:
var doc = Fl.getdocumentdom (); 
var name = Doc.name; 
The set output path is Flaout 
var path = "file:///D:/flaout/"; 
Gets the FLA filename and removes the. fla extension 
var dir = name.substring (0, name.length-4) 
var items = doc.library.items; 
Path = path + dir; 
Create a directory 
Flfile.createfolder (path) with the same name as the FLA in the output path; 
for (i = 0; i < items.length i++) 
{ 
   if (Items[i].itemtype = "Bitmap") 
    { 
       fl.trace ("Output file =>" + PA th + "/" +items[i].name); 
       Items[i].allowsmoothing = true; 
       Items[i].compressiontype = "lossless"; 

       Gets the current component directory 
       var subpath = path + "/" + Items[i].name; 
       Subpath = subpath.substring (0,subpath.lastindexof ("/")); 
       Create a directory 
       Flfile.createfolder (subpath); 
       Output file 
       items[i].exporttofile (path + "/" + Items[i].name); 
    } 
Alert ("Output complete, close file, do not save"); 

The above is a JSFL file code that puts this code in a notepad with the suffix name changed to. JSFL here named EXPORTFILE.JSFL use Adobe Flash CS to open a FLA click commands--> Run Command ... Select EXPORTFILE.JSFL. The FLA is not saved after the output is not saved because we simply export the picture in the FLA and do not need to modify the Fla. You can see all the pictures in this FLA in d:/flaout if you need to, you can modify the saved path yourself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.