Since Flash Media Server’s first release, ActionScript 1.0 (JavaScript) has always been necessary for server-side development. The task of developing on the server in the default language is known to be a difficult and tedious task, and developers have been demanding a better development programming language for years. Influxis has now answered that call with the beta release of haXeFMS. haXeFMS is a haXe library which allows you to use the haXe target Flash Media Server. Built on top of the haXe JavaScript development target, with the proper IDE haXeFMS can offer support for:

  1. Code auto completion.
  2. Syntax error detection.
  3. Optimized code compilation.

The core haXe language is very similar to ActionScript 3 so the transition is easily made for those experienced Flash developers. Since haXe also supports Flash compiling, you can build your client side libraries on haXe and centralize them. The current version of haXeFMS (beta 0.9) offers full support the API’s of Flash Media Server 4.5. Extended API’s have also been implemented for further support. If you are ready to make your FMS server-side development life easier then give haXeFMS a try and let us know how it works.

Requirements

  1. Flash Media Server 4.5 is required to run the full haXeFMS Library. Influxis offers several plan options at great prices.
  2. For best results use an IDE which supports haXe like FlashDevelop, FDT, and numerous other IDEs.

Installation

  1. Download and install the latest version of haXe.
  2. Download the latest version of haXeFMS.
  3. Unzip the downloaded haXeFMS folder and grab the contents within the installerContents folder. Drop them into the location where your haXe install is located. Please make sure to back-up before overwriting.
  4. Include the contents of the lib folder where your local haXe project is located.
  5. When building haXe projects please include fms in your command line options under “conditional compilation flag (-D fms)”. For more details please visit the haXe website.
  6. Make sure to compile code to JavaScript and output to main.asc (-js main.asc).

Using API

To create a new haXeFMS application, create a new Main.hx file. If using an IDE make sure to create a new haXe JavaScript project. The default template should look like this:

package;
import js.Lib;
import org.com.fms.core.API;

class Main
{
static function main(): Void
{

}
}

You can use the application typedef object of the js.Lib namespace to gain access to the main application class:

package;
import js.Lib;
import org.com.fms.core.API;

class Main
{
static function main(): Void
{
Lib.application.onAppStart = function()
{
trace( “This app has started” );
}
}
}

Another way to access the main class methods is to use the FMSApplication class to override the main class:

package;
import js.Lib;
import org.com.fms.core.API;
import org.com.fms.framework.core.FMSApplication;

class Main extends FMSApplication
{
Private static var _MAIN_APPLICATION_: FMSApplication;

public function new(): Void
{
super();
}

override private function pOnAppStart(): Void
{
trace( “This app has started” );
}

override private function pOnConnect( client:Client, args:Array ): Void
{
trace( “The client has connected and is from ip: ” + client.ip );
}

static function main(): Void
{
MAIN_APPLICATION_ = new Main();
}
}

To compile the project grab the compile.hxml (in the lib folder) file and copy it to the directory your Main.hx file is located. Link the compile.hxml to the haxe.exe executable where haXe was installed and double click the compile.hxml file. You can also open the command line window from the directory where the project is located and type in “haxe compile.hxml”. If you are using an IDE please make sure to output the file to main.asc using the JavaScript target. Also make sure to add fms to the compilation command option. This will output the main.asc file which you can then install where your FMS application is located on the server. Make sure to reload the application through the FMS Administration Console if updating the main.asc.

Resources

Find out what haXe is about

Learn haXe

FMS Server Language Reference

haXe Mailing List

 

 

Leave a Reply

Current day month ye@r *