Multiplatform (iOS, Android, Html5, Flash) download and locally save of zip file

Hi friends,
I’m trying to port my Multiplatform (one code for all screen types and AIR supported devices) AS3 Game Framework to OpenFL, but I got stuck at these points (I’ve searched and tried a lot already, but some solution are no more compatible with the new OpenFL version and/or are not multiplatform:

  • (iOS, Android, Html5, Flash) How to download and save a zip file from the net, to the local “documents” folder of the application?
  • (iOS, Android, Html5, Flash) How to get the path of the local “documents” folder of the application?

Can somebody help me with these?

Many Thanks!

If you are using Flash, you will need to use the custom Flash dialog window to save a file, I believe. Otherwise Flash is not allowed to write to the user’s system.

HTML5 doesn’t have access to write on the system at all, I believe.

iOS and Android you should be able to download to a storage directory, in both of these targets openfl.utils.SystemPath.documentsDirectory might work, you should be able to use a URLLoader to download files. Long-term, I’m not sure of the best place to put the API for finding system directories (perhaps I should put it in lime.system.System but for now, that should work on iOS/Android :smile:)

Hey Syngma :smile:
Thanks for your reply.

I’ve already searched through the whole API but there is no
openfl.utils.SystemPath.documentsDirectory

:frowning:

Here’s what it looks like:

https://github.com/openfl/openfl/blob/master/openfl/_v2/utils/SystemPath.hx

AHHHHHHHH :smiley:

THERE IS IT! :smiley:

MANY MANY THANKS SINGMAJESTY!

1 Like