Intro To haXe Development With FDT

From FDT Documentation

(Difference between revisions)
Jump to: navigation, search
(Installation)
(Wrap Up)
 
(2 intermediate revisions not shown)
Line 5: Line 5:
= <center>Video</center> =
= <center>Video</center> =
{{#widget:Vimeo|id=42348465|width=600|height=400}}
{{#widget:Vimeo|id=42348465|width=600|height=400}}
-
 
-
= Using the FDT HaXe Plugin  =
 
-
 
-
Before authoring and compiling haXe, you'll need to define the haXe SDK location for FDT to reference.
 
-
 
-
== Setting up the haXe SDK Location  ==
 
-
 
-
Open FDT's preference widow and navigate to ''HaXe&gt;SDK''&nbsp;and input the installation directory of haXe. If you're not sure where haXe is installed, the installation window will clue you in. Here we can see that the installer is moving files and creating links to ''/usr/lib/haxe'' - this is the default location for OSX. After inputing the sdk location, hit ''OK.''
 
-
 
-
== Create Your First haXe Project  ==
 
-
 
-
All haXe projects now have there own project wizard. Begin by creating an ''Basic HaXe Project'', If you can't see this in the new project menu or don't see new HaXe Classes you will need to goto the Window menu and select the "Reset Perspective" option and they will appear.
 
-
 
-
<br>
 
-
 
-
[[Image:Empty haxe project wizard 1.png|center|600px|Empty haxe project wizard 1.png]]
 
-
 
-
During the process of creating a HaXe Project you will be able to select the HaXe SDK just for this project by ''"Enabling project specific settings"''.<br>
 
-
 
-
[[Image:Empty haxe project wizard 2.png|center|600px|Empty haxe project wizard 2.png]]
 
-
 
-
Then finally you can configure the target output of your HaXe Project for creating the basis of our HaXe project configuration (HXML), In this case we creating a flash project.<br>
 
-
 
-
[[Image:Empty haxe project wizard 3.png|center|600px|Empty haxe project wizard 3.png]]
 
-
 
-
== Convert Project To A HaXe Project  ==
 
-
 
-
With your first class created, right click on the project and select ''Add HaXe Project Nature''. When this happens, FDT will ask you to input some project variables. We already have configured our ''HaXe SDK Location'' so just hit ''Next''.
 
-
 
-
Let's leave the haXe configuration file to the default location but modify the ''Output Path'' to ''bin/Main.swf''. When completed, FDT will have created a few extra files and folders for us. We don't need to worry about ''.hxtypes'' but we use ''project.hxml'' to set configurations to our project. We can also see that FDT has begun to parse our project for syntax errors.
 
-
 
-
== Adjust Compiler Settings  ==
 
-
 
-
Before writing some code, let's alter some compiler options - this is done via the ''project.hxml'' file. Open us the file by double clicking on it, you will see a page similar to image below. You can click on the source tag at the bottom if you prefer to edit it manually.<br><br>[[Image:Haxe compilation settings.png|center|Haxe compilation settings.png]]
 
-
 
-
= 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 [[Image:Img preview.png|Img preview.png]]. Or type in the the code yourself to begin exploring the syntax auto completion FDT provides.<br>
 
-
 
-
<br> <source lang="actionscript">
 
-
 
-
package ;
 
-
import flash.display.Sprite;
 
-
import flash.events.Event;
 
-
 
-
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){
 
-
    view.graphics.clear();
 
-
    view.graphics.beginFill(0xff0000, 1);
 
-
    view.graphics.drawCircle(x, y, 50);
 
-
 
-
    if(is_invalid_x()) speed  = speed * -1;
 
-
    x+= speed;
 
-
    }
 
-
 
-
    function  is_invalid_x() : Bool {
 
-
    return x > max_x || x < 0;
 
-
    }
 
-
}
 
-
 
-
</source>
 
-
 
-
== 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&nbsp;''older. If it doesn't appear, try refreshing your project.
 
-
 
-
== View Your SWF  ==
 
-
 
-
You can view your SWF with FDT by&nbsp;selecting Run As &gt; SWF File. You can also use Ant Scripts with your HaXe Project&nbsp;but for more in depth know-how on using Ant, check out the [[FDT and Ant Tutorial]].<br>
 
-
 
-
(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 [http://bugs.powerflasher.com/jira/browse/FTDHXPLIN PowerFlasher JIRA site], our community driven tracking website, to make the haXe support in FDT the greatest ever.<br>
 

Latest revision as of 16:33, 17 May 2012

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. 

Video

Get FDT5