Can the libraries\bin path be changed for html5 output?

We have a project created in FlashDevelop outputting to flash and html5, which after moving from the Flash IDE and lots of head scratching finally works :smile:

It includes a few fonts and an swf symbol library which for the flash output is all in one directory, so no problem, the html5 output apart from the js file in the top directory it also creates a few sub directories, fonts, lib and libraries also with a subdirectory \bin.

However the end client is looking to run on an Asp.net server which defines bin directories as protected so I’m being told to change the directory name so \bin isn’t used. Unfortunately I’m probably being dim but I can see how to do this.

I’ve tried editing the ApplicationMain.hx and DefaultAssetLibrary.hx files, but they simply get rewritten to bin when compiled.

I suspect this is defined in a Template somewhere, but can’t find where, or maybe I have the wrong idea.

I’m guessing I’m not the first person to encounter this so any guidance would be great.

Thanks

When I output, I get something like “Export/html5/bin/libraries/mylib.dat”

This should be fine, right? Everything under “bin” in this case is then copied to your web server. Which versions are you using?

Yes, I’m copying the files from the bin directory to the server, unfortunately the compile is creating a directory under libraries also called bin?

I think it’s being output to the bin/html5/bin/libraries/bin/ashLib directory because I’m using an swf symbol library, as the directory is full of png’s from the swf. It works fine on an apache server and would work on ASP apart from the path issue.

FlashDevelop 4.6.4.1

actuate: [1.7.5]
gm2d: [3.1.12]
hxcpp: [3.1.39]
hxtools: [1.1.6]
lime-tools: [1.5.7]
lime: 1.0.1 [2.0.0]
nme: [5.1.8]
openfl-html5-dom: [1.2.2]
openfl-html5: [1.4.2-beta]
openfl-native: [1.4.0]
openfl-samples: [2.1.0]
openfl-tools: [1.0.10]
openfl: [2.1.6]
svg: [1.0.8]
swf: [1.7.0]

Oh, gotcha. Sorry, I was looking at a project without images. That’s currently set within the “tools/Tools.hx” (I think is the path) file in the SWF library, which is then compiled with “haxe compile.hxml” in the same directory. Thinking about what might be a better convention

Perhaps instead of “bin” it should be named based on the SWF library ID, so as to prevent collisions. I thought I had done something to resolve that

Brilliant, thanks, this is the line I presume…

381: symbol.path = “libraries/bin/” + library.name + “/” + id + “.png”;

Could this simply be…

symbol.path = “libraries/” + library.name + “/” + id + “.png”;

Without the extra path in there?

I think so, that still seems pretty clean, right?

If we did that, we might consider putting the .dat file in the directory as well, so you get “mylib.json”, and a “mylib” directory with all the data for it

It makes sense and would keep the output easier the understand.

Hi I need an additional clarification on this one, because I encountered a similar , bigger issue. The game provider I work for runs a platform in which a *.js file is not kept in the same directory as asset files … So the regular build does not do the job for me. :frowning:

I have to change the path of lib from

from

lib/swfpack/swfpack.bin

to
swf/gameid/lib/swfpack/swfpack.bin

along with all image paths inside a pack :frowning:

So I guess my question is where can I change it ? What is a Tools.hx file and where can it be found ? Some additional instructions I suppose …

Hm, while I was listing the documentation and various issues I came to terrifying thought that this actually might not be possible :frowning: ??

Maybe you can change js output path if they require js in diff folder?
<config:html5 dependency-path="js/lib" />

Does this work?

I don’t think you understood what I was speaking about. I am not loading Assets, I am embedding them .

library path=“assets/RedSplash.swf” preload=“true” generate=“true”

I I am to load all assets rather then embed them, that would kinda lose the purpose of a library, wich is a big thing. Actually the only thing that separates you platform from other platforms - like Pixi.js …

So, my goal is not to load assets and than wait for them … I wan’t to use the Flash approach.

var assetPack:MovieClip = cast(new AssetPack(), MovieClip);
assetPack.getChildByName(“button”);

the problem is, this works but the path of assets embedded in lib always remains the same lib/AssetPack/AssetPack.bin

I want to change this path into

gameid/assets/lib/AssetPack/AssetPack.bin

Is there a way I can do this, or this all generate=“true” (embed) is no use at all to me, and I have to change my entire code of the platform and game ?

I can think of two approaches, currently:

  1. Use openfl process file.swf then use Loader or AssetLibrary.loadFromFile at runtime
  2. Use openfl process file.swf then add it to your assets, you should be able to use Assets.loadLibrary("path/to/file.swf");

Neither of these allow for generate="true" (to generate Haxe classes) but it would allow for the library to be loaded at runtime

Perhaps there could be a way to set the output folder for processed libraries though

Hi I found a way. It required from me to change the Lime library, but it can be done.

I changed the lime.utils. AssetLibrary

method

@:noCompletion private function __cacheBreak(path:String):String
{
return Assets.__cacheBreak(path);
}

in to

@:noCompletion private function __cacheBreak(path:String):String
{
return “local/path/gameid/anystring” + Assets.__cacheBreak(path);
}

This works. However, the topic is now changed to :slight_smile: - Can it be done dynamically via configuration ?

p.s. I don’t want to use a loader. That is so HTML … I hate it.

The SWF tools are located here:

There are a number of “lib/” strings in the file, in the current OpenFL dev I think it may be possible to write this to a new value and have it still work. You must openfl rebuild tools in order to compile any changes this file. I think that if changing these values do work, then we may be able to add some kind of targetPath value to the <library /> tag (similar to the asset tag) in order to make this configurable