Skip to content

Adding named resources

devboy edited this page Apr 4, 2012 · 3 revisions

To add files to your compilation target as named resources, assign a Hash with name/path pairs to compile.options.resources.

define "MyProject" do
  compile.using :hxswf # Or any other haXe compiler
  compile.options.resources = {
    :myAsset => "assets/myAsset.jpg",
    "myAsset2" => "assets/myAsset2.mp3",
    :myAsset3 => path_to(:assets,"myAsset3.png")
  }
end

The name part of the hash can be a String or a Symbol. The path must be a String. As the haxe compiler is run for the base directory of the current project, you can use the path_to helper method.

Clone this wiki locally