HaXe SWFMILL Resource Converter
From dis-Emi-A
This script can be used to convert SWFMILL formatted resource.xml files into the appropriate haxe, or AS3, class definitions. This simplifies using resources: it allows you to create just a resource.xml file and not need to worry about further definitions.
Contents |
Command Line
convert_resources.rb resource.xml output_dir source_swf mode=[as|hx]
- resource.xml
- the swfmill resource file which should be converted into class definitions
- output_dir
- The base directory to where output files should be written, package paths will be created as sub-directories. Each resource listed in the resource.xml will create a single file in the output directory. This directory should be included in your compiler source path so it can locate these class files.
- source_swf
- The swf file generated by swfmill of this resource.xml. This is required for the AS3 output mode, but just to be consistent please specify it in both modes.
- mode
- Which output format is desired, "as" for AS3 embedded format, or "hx" for HaXe SWF resource inclusion.
Makefile example
This is a simple example of how this might look in a makefile -- a complete example for generating the resource SWF as well. This will regenerated the SWF file, and the classes, whenever one of the source images, or resource.xml is changed. This assumes that "convert_resources.rb" is in your path, which it likely isn't.
IMAGES=${wildcard srcimages/*}
resource.swf: resource.xml ${IMAGES}
swfmill simple resource.xml resource.swf
convert_resources.rb resource.xml . resource.swf hx
Download
Since the main library is not yet ready, I'm provided this individual script here for now.
http://disemia.com/temp/convert_resources.rb
Requirements
This script requires Ruby with REXML installed.
