Assets location

Hi all!

I ran into a little problem. We decided to move the folder containing our assets to a shared location
for all of our applications running on the same webserver.
So the assets might be at: http://domain.com/sharedAssets/applicationA

The JavaScript sources are in the exact same folder too.
Now if we load the JavaScript from a different location, maybe domain.com/fancyApplication/index.html

It fails to load the resources because it tries to find 'em in the current folder which is /fancyApplication
not /sharedAssets/applicationA.
Alright after some research I found out that there is an additional parameter to the openfl.embed
function telling it where to look for assets. By the way, it would be nice if something important like
this would be documented somewhere. :wink:

Okay!
app.embed (“openfl-content”, w, h, “63A1FF”,"/sharedAssets/applicationA/");

does the job pretty good - at least for loading sounds. The problem is we’re using swf assets too.
There’s a .json file which tries to load the assets from a subfolder, which is not inside /fancyApplication.

It would be cool if it’s affected by the assetsPrefix parameter too!
Is there anything I could do instead of changing the paths in the .json file by hand?

We have changes in the development version of Lime and OpenFL that I believe will solve this, I haven’t performed specific testing for this on the HTML5 target, but based upon how I’ve redone the asset library system, it’s all based on “root paths” which should be possible to update using that asset prefix value

Thanks singmajesty!

But where to get and how to use those development builds? :wink:

By the way - manually editing the .json file didn’t help. Though it loads the assets
successfully I’m getting other errors:
TypeError: a is null
be.prototype<.__copyChannel()
be.prototype<.getImage()
ib.prototype<.__createObject()
da.prototype<.__renderFrame()
da.prototype<.__updateFrame()
da.prototype<.__fromSymbol()
da()

TypeError: c is null
qa.prototype<.__enterFrame()
qa.prototype<.__enterFrame()
da.prototype<.__enterFrame()
qa.prototype<.__enterFrame()
mc.prototype<.render()
l/c()
mc.prototype<.addRenderer/</<()
ja.prototype.dispatch()
vd.prototype.handleApplicationEvent()
l/c()

Try:

http://www.openfl.org/builds/lime/latest/

http://www.openfl.org/builds/openfl/latest/

You can then use haxelib local path/to.zip for each downloaded file to locally install :slight_smile:

Great stuff singmajesty!

This solved my problem. Awesome! I hope you can feel me clapping on your shoulder
right now. :wink:
Thanks!

1 Like