Reusing same project for multiple applications but different assets

I am working on a project, in which I notice that 99% coding is going to be reused. Only the assets that are being used and preloaded, will be going to be changed. But I am wondering, how can I manage including the assets conditionally in the project.xml ?
I see it being done when using platforms like html, flash etc, by using tag attributes like if=‘html5’ . But is their any way I can use custom string, like " if=‘game1’ " etc ?

Because if I don’t include the conditionally, and instead preload all of the assets for each project, that’s definitely going to increase the time at preloading. Right ?

maybe you can set multiples “project.xml” or “project.hxp” files, one file for each different build, setting different asset paths.

You can compile adding the file/path argument on build command:

  • openfl build /path/to/project/project_01.xml windows
  • openfl build /path/to/project/project_02.xml windows
  • openfl build /path/to/project/project_03.xml windows

http://www.openfl.org/learn/docs/command-line-tools/basic-commands/

1 Like

You can also do something such as:

<assets path="assets/game2" if="game2" />

and use openfl test flash -Dgame2

Another option is to use an include, such as:

“Projects/Game1/project.xml”
“Projects/Game2/project.xml”
“Projects/Common/include.xml”

and then the “Game1/project.xml” and “Game2/project.xml” could both use

<include path="../Common/include.xml" />
1 Like