Intro To haXe Development With FDT

From FDT Documentation

Revision as of 16:32, 17 May 2012 by Aklement (Talk | contribs)
Jump to: navigation, search


About FDT HaXe Support

HaXe is an open source and multiplatform programming language. Developed in collaboration with Powerflasher and supported by Influxis, the FDT haXe plugin provides developers a powerful tool for authoring the haXe multi-platform language. Our goal is to provide the best haXe coding experience and that it feels like coding in the AS2, AS3 or MXML editor of FDT: same shortcuts, same syntax coloring, same coding comfort. 


Compiling and Viewing your .SWF

Adding HaXe Code

The syntax of haXe is a bit beyond the scope of this tutorial - but that doesn't mean we have to code something boring! Copy and paste the code below to make a simple animation Img preview.png. Or type in the the code yourself to begin exploring the syntax auto completion FDT provides.

package ;
import flash.display.Sprite;
class Main{
	static var view:Sprite;
	static var x: Float = 0;
	static var y: Float = 200;
	static var speed :Float = 20;
	static var max_x : Float = 550;
    static function main() {
		 new Main();    
    function new(){
    	view = new Sprite();
    	flash.Lib.current.addChild (view);
    	flash.Lib.current.stage.addEventListener(Event.ENTER_FRAME, update_view);
    function update_view (e: Dynamic){;, 1);, y, 50);
    	if(is_invalid_x()) speed  = speed * -1;
    	x+= speed;
    function  is_invalid_x() : Bool {
    	return x > max_x || x < 0;

Compiling HaXe

For the time being, FDT will automatically attempt to compile your .SWF every time you save it. If there are no errors in your project, your .SWF will appear in your project older. If it doesn't appear, try refreshing your project.

View Your SWF

You can view your SWF with FDT by selecting Run As > SWF File. You can also use Ant Scripts with your HaXe Project but for more in depth know-how on using Ant, check out the FDT and Ant Tutorial.

(Note: If you get an error while tying to run the Ant file, it's probably a JRE error, check out the FDT and Ant Tutorial to learn how to correct it.)

Wrap Up

That's it, you've successfully set up your first FDT haXe Flash project!

As this plugin is still a beta release, please bare with us! For any feedback, feature requests, improvements, bugs and other issues we encourage you to use PowerFlasher JIRA site, our community driven tracking website, to make the haXe support in FDT the greatest ever.

Get FDT5