January 08, 2005
Automated Batch Exporting of Flash .fla files
Macromedia Flash is fast becoming a major platform for web development. My own group is developing not just content, but tools and even authoring environments using Flash. But one area where Flash lags far behind is in development process management.
In particular, my group recently had to re-Export about 600 Flash .fla files while rebuilding a large project. Unfortunately, Macromedia provides no command-line interface, no batch processing mode that will allow automated, managed build processes such as Apache's ant, which is a staple in most standard software development groups.
A search on the Web and among colleagues found one promising tool - FlashCommand. This command-line interface to Flash seemed to offer a way to Export Flash via a command script. Unfortunately, in practice, this didn't work - it launches the Flash GUI, where the export operation stalls on a modal dialg box waiting for input that will never come.
My solution - it turned out to be fragile but workable for a one-off kind of need. AutoIt V3 is a scripting tool that allows scripting the Windows GUI. It depends a lot on window titles and on timing - even the speed of your system can affect the script you'll write for certain operations - but it worked and turned the export of 600+ .fla files into a short, unattended operation. The script that worked is in the extended part of this posting (click the continue link below"), for those who could benefit from it.
This is no substitute for a real command-line mode and real 'ant' integration for managing builds, as is so essential in busy development shops doing complex projects. Macromedia needs to step up to the plate and make professional-grade development tools available if it wants to continue to drive towards playing in the "big leagues".
Here's the AutoIt script code. It assumes that all your .fla files are in c:\tmp, and that you're using Flash MX 2004 Professional. You can easily edit the script for different versions or file locations. Just save this text in a file named [something].au3, and then call that file from the Windows command-line.
;code begins here
; Shows the filenames of all files in the current directory
$search = FileFindFirstFile("*.fla")
; Check if the search was successful
If $search = -1 Then
MsgBox(0, "Error", "No files/directories matched the search pattern")
Exit
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
;c:\tmp in the following line can be edited to your choice of file location
Run("C:\Program Files\Macromedia\Flash MX 2004\flash.exe c:\tmp\"& $file)
WinWaitActive("Macromedia Flash MX")
; send export command
Send("^!S")
WinWaitActive("Export Movie")
; set new filepath and name
$file = StringTrimRight($file, 4)
Send("C:\tmp\" & $file & ".swf")
Send("{ENTER}")
WinWaitActive("Export Flash Player")
; dismiss export settings dialg
Send("{ENTER}")
; if you're not using MX 2004 Pro, edit the following line to match the Window title of your version
WinWaitActive("Macromedia Flash MX Professoinal - [" & $file)
; close .fla file
Send("^w")
Send("n")
WEnd
; Close the search handle
FileClose($search)
Posted by larryb at 11:16 PM [permanent link]
| TrackBacks (1)
Category: Web and Software Development
Category: Web and Software Development
TrackBack URL for this entry:
http://www.learningapi.com/cgi-bin/mt-tb.cgi/64
Listed below are links to weblogs that reference 'Automated Batch Exporting of Flash .fla files' from learningAPI.com: Media and Learning Technology - Larry Bouthillier.
http://www.learningapi.com/cgi-bin/mt-tb.cgi/64
Listed below are links to weblogs that reference 'Automated Batch Exporting of Flash .fla files' from learningAPI.com: Media and Learning Technology - Larry Bouthillier.
Re: Updating Banner Ads
Excerpt: Haven't dealt with it myself, but was wondering about a very similar question...
Weblog: tribe.net: www.learningapi.com
Tracked: February 15, 2006 01:32 PM
Excerpt: Haven't dealt with it myself, but was wondering about a very similar question...
Weblog: tribe.net: www.learningapi.com
Tracked: February 15, 2006 01:32 PM
Search
Archives
Recent Entries
Facebook and Academic Institutions - Content or Context?
Video Transcript Browsing Interface
The New RealPlayer 11 - A First Look
Is RealPlayer going to make a comeback?
Is Amazon's S3 the cheapest streaming video hosting out there?
Image, Audio & Video Search - Reading Content and Context
e-Learning 2.0 - The End of the Course?
Online Video and Web 2.0 - What's missing?
Fundamentals of Website Development - Course Resources
A Full-Featured Flash Video Player
Video Transcript Browsing Interface
The New RealPlayer 11 - A First Look
Is RealPlayer going to make a comeback?
Is Amazon's S3 the cheapest streaming video hosting out there?
Image, Audio & Video Search - Reading Content and Context
e-Learning 2.0 - The End of the Course?
Online Video and Web 2.0 - What's missing?
Fundamentals of Website Development - Course Resources
A Full-Featured Flash Video Player
Author Links
About the author
Speaking Engagements
Streaming and Multimedia Articles and Tutorials
My Harvard Business School Bio page
Blogroll
Digital Media Bulletin - Jose Alvear
ResearchForward - Michael J. Hemment
BusinessOfVideo.com
Online Video Punch
The Learning Circuits Blog
Elatable - Bradley Horowitz
Harold Jarche
HBS Prof. Andy McAfee on Web 2.0
DV for Teachers
SciTech Daily Review
Quirksmode - Javascript & AJAX
Educational Technology & Life
Jon Udell
Learning Technology - Denis Saulnier
Weblog Categories
Digital Restrictions Management
eLearning & Instructional Technology
Innovative Technology
Misc
Personal Video Publishing
Streaming Media
Streaming Media Technology Tips
Video and Multimedia Technology
Web and Software Development
Weblogs
External Links
