Hi folks,
i have rewritten my ANT file, i've posted few days ago.
in order to use you need to install BSF (http://jakarta.apache.org/bsf/)
and RHINO (http://www.mozilla.org/).
its easy to install and easy to configure with eclipse.
the target creates a library.xml file from scratch and inserts all files
located in a specific assets folder.
its still not the best solution because it is realy slow. on my machine
it takes 1-3 seconds including the swfmill
execution. But it works. Perhaps i will make a Java based ANT task if i
start to understand those strange filesets.
my last post was a little unfruitful because no one has posted a
feedback. So please send me a feedback.
for example you have the following folderstructure
/assets
/core
splash.png
the target would create a swfmilll library.xml file like this:
<?xml version="1.0" encoding="iso-8859-1" ?>
<movie width="800" height="600" framerate="31">
<background color="#ffffff"/>
<frame>
<library>
<clip id="core_splash_png" import="D:\workspace\assets\core\splash.png"/>
</library>
</frame>
</movie>
list of used properties
build the build folder
library folder where all assets are placed
library.file file name of the xml file to use with
swfmill
movie.width width of movie created by swfmill
movie.height height of movie created by swfmill
movie.framerate framerate of movie created by swfmill
movie.bgcolor background color of movie created by swfmill
flame.swfmill location of the swfmill executable
flame.mtasc.target filename to create with swfmill ie test.swf
<target name="precompile">
<mkdir dir="${build}"/>
<delete file="${library.file}"/>
<script language="javascript"><![CDATA[
importClass(java.io.File);
var dir = project.getProperty("library");
var outFile = new File(project.getProperty("library.file"));
var fs = project.createDataType("fileset");
fs.setDir(new File(dir));
fs.setIncludes("**/*.swf");
fs.setIncludes("**/*.png");
var echo = project.createTask("echo");
echo.setFile(outFile);
echo.setAppend(true);
var ds = fs.getDirectoryScanner(project);
var srcFiles = ds.getIncludedFiles();
createHeader();
for (i=0; i<srcFiles.length; i++) {
createClip(srcFiles[i]);
}
createFooter();
function createHeader()
{
var w = project.getProperty("movie.width");
var h = project.getProperty("movie.height");
var fps = project.getProperty("movie.framerate");
var bg = project.getProperty("movie.bgcolor");
appendToFile('<?xml version="1.0" encoding="iso-8859-1"
?>\n');
appendToFile('<movie width="' + w + '" height="' + h +
'" framerate="' + 31 +'">\n');
appendToFile('<background color="' + bg + '"/>\n');
appendToFile('<frame>\n');
appendToFile('<library>\n');
}
function createClip(filename)
{
var id = filename.replace(".","_").replace("\\","_");
appendToFile('<clip id="' + id + '" import="' + dir
+'/'+ filename + '"/>\n');
}
function createFooter()
{
appendToFile('</library>\n');
appendToFile('</frame>\n');
appendToFile('</movie>\n');
}
function appendToFile(msg)
{
echo.setMessage(msg);
echo.perform();
}
]]></script>
<exec executable="${flame.swfmill}">
<arg value="simple"/>
<arg value="${library.file}"/>
<arg value="${build}\${flame.mtasc.target}"/>
</exec>
</target>
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org