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?
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:
lime.ui.FileDialog for browse, select, save dialogs
lime.system.System with default user, desktop (etc) file paths
OpenFL has openfl.net.FileReference which uses lime.ui.FileDialog under the hood, as well as openfl.net.Socket or openfl.net.XMLSocket for sockets
Haxe supports file and TCP networking
sys.io.File for reading and writing files
sys.io.FileSystem for making directories, listing paths
sys.io.Process for more complex background processes
Sys for setting the working directory, running a simple command, etc
sys.net.Socket for sockets (used by openfl.net.Socket)
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.