Some help for a flah developer (file access and similar things)


Hi, I’m coming from a flash background (in fact using the apache flex sdk) and would like to check out some “haxe ways” to make thing work. Where do I look for this info?

First, I’d like to learn about file access. For flex/air I use the File class. Some of my issues:

  • browse for file select
  • list files in a folder
  • run an executable file
  • open and read/write files on disk
  • search for some default system locations like user folder, desktop and so on

Then, I’d need to learn a way to mimic the native process class. Is there a way to do it on haxe, like staring a system process and keep watching and receiving its results?

Also, I’d love to learn how to work with sockets. On flex/air I use the SocketServer class a lot, how can I start a TCP server on haxe and keep wathing for connections?

Thank you a lot.


First off, Haxe provides a sys define for “system” platforms (ones with file system access). This is helpful for wrapping this type of functionality. For example:

function writeFile (path:String):Void {
    #if sys
    File.saveContent (path, "Hello World");

Lime provides the following APIs:

  • lime.ui.FileDialog for browse, select, save dialogs
  • lime.system.System with default user, desktop (etc) file paths

OpenFL has which uses lime.ui.FileDialog under the hood, as well as or for sockets

Haxe supports file and TCP networking

  • for reading and writing files
  • for making directories, listing paths
  • for more complex background processes
  • Sys for setting the working directory, running a simple command, etc
  • for sockets (used by

I also know someone who just posted a networking library for Haxe, I haven’t tried it though:

Other defines from Lime may be helpful for distinguishing between platforms and environments, like windows, mac, linux, ios, android, desktop, mobile, native, flash, html5, web, etc.

#if (desktop && !windows)