Skip to content

Instantly share code, notes, and snippets.

@9re
Created December 25, 2010 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 9re/754947 to your computer and use it in GitHub Desktop.
Save 9re/754947 to your computer and use it in GitHub Desktop.
publish all the flas in the current directory
#!/usr/bin/perl
use strict;
use JSON qw/to_json/;
use IO::All;
use Cwd;
my @flas = ();
my @tempflas = grep {
my $swftest = $_;
$swftest =~ s/\.fla/.swf/;
!-e $swftest;
} glob("*.fla");
my $arr = to_json \@flas;
my $pwd = getcwd();
$pwd = "file:///$pwd/";
my $jsfl =<< "_JSFL_";
fl.outputPanel.clear();
var flas = $arr;
var len = flas.length;
for (var i = 0; i < len; ++i) {
var fla = "$pwd" + flas[i];
var swf = fla.replace(".fla", ".swf");
fl.trace(fla + " -> " + swf);
fl.openDocument(fla);
var doc = fl.getDocumentDOM();
doc.exportSWF(swf, true);
doc.close(false);
}
_JSFL_
io('temp.jsfl') < $jsfl;
`temp.jsfl`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment