Moving from FDT to MonoDevelop for haXe and NME

Before I start with this post I should mention that Joshua Granick (on of the creators of NME) has a post about:How to Install Haxe, NME and MonoDevelop! That will save me some time and who can explain that better than Joshua.

I wrote something similar when I moved from PC (FlashDevelop) to OSX (FDT) (read my post: moving-from-flashdevelop-to-fdt/). Which also was a reminder when I needed to reinstall or explain it to a college.

Want to know why I’m using MonoDevelop?
Moving from FDT to MonoDevelop is not a big step (my opinion ๐Ÿ˜› )

After reading my post, it looks like I’m leaving FDT… That is not what I’m doing: I’ll keep on using it for AS3.
But I hope to ‘take’ some features from FDT to MonoDevelop

Adding your own short-cuts / key-binding

First let add some features that I use a lot:
MonoDevelop > Preferences... (CMD+,) > Key Bindings
search for “comment”
Toggle Line Comment : Edit Binding > (CMD + 7)
search for “case”
Uppercase Selection : Edit Binding > (CTRL + SHIFT + X)
Lowercase Selection : Edit Binding > (CTRL + SHIFT + Y)
search for “template”
Insert template.. : Edit Binding > (CMD + SHIFT + 1) [doesn’t work yet]

Using default Short cuts – (besides the ‘normal’ short cuts)

Then there are some default shortcuts you use a lot:
run >> ALT + CMD + enter
debug >> CMD + enter (doesn’t work)
move the line or highlighted section down >> ALT + ARROWDOWN
move the line or highlighted section up >> ALT + ARROWUP
show completion window >> ALT + SPACE

Adding personal info

Don’t have to explain this … right?
MonoDevelop > Preferences... (CMD+,) > Author Information

Changing settings

Perhaps this is very personal, but I’m not writing this for you alone (it’s also a reminder to myself!)
MonoDevelop > Preferences... (CMD+,) > Text Editor > Behavior >

  • check: Insert matching brace
  • check: Smart semicolon placement
  • check: Enable on the fly code formatting (doesn’t do anything)
  • check: Format document on save (doesn’t do anything)

MonoDevelop > Preferences... (CMD+,) > Text Editor > Behavior > XML

  • check all

Moving on:
MonoDevelop > Preferences... (CMD+,) > Text Editor > Syntax Highlighting
I installed Monokai for Darius Kucinskas: you can get it from github. That because I use it on TextMate and gotten use to it….
Joshua Granick has created a FlashDevelop color scheme (if there are people who want to move from PC to Mac/Linux).


And then the most interesting… the one that doesn’t seems to be working
MonoDevelop > Preferences... (CMD+,) > Text Editor > Code Templates
Code templates are awesome and speed up your development a lot (create a getter/setter in just one click for example)
Just do the following:
Edit > Insert template...
And remember that the mime type is:
mime: text/x-haxe
It really doesn’t matter what you do… for example // test

but then only bugs…


Something to read: The official statement from MonoDevelop about Code Templates.

I would like to see

I miss some stuff that I was very use to, so lets make that a NICE-TO-HAVE-LIST

  • feedback when exporting/compiling to a target like SublimeText 2 or in the terminal.
  • code completion on variables and functions
  • templates that work
  • duplicate line (up/down)
  • code formatting
  • auto import
  • code checking while typing/checking without running
  • if auto code checking is not going to happen: a shortcut to check your code
  • automatic “add to folder” (for all folders)
  • TODO added to “Task list”
AS3 FDT Flash

FDT and ANT – part 1

Just started to work with FDT and wrote about my “troubles” (post#1 and post#2) with my transition from FlashDevelop.
(have to be very carefull what I say: “they” are watching me: here and here ๐Ÿ˜€ )

And it seems to be a very natural (geeky) thing to learn about ANT.

And where do you go to learn about ANT and SWF/Flash/FDT? (Google?)
After some tinkering all I got was: failed to create task or type fdt.launch.application

This post was very useful: FDT and ANT | A User’s Guide – Part I by Alan Klement.
Watch the videos (I’m not very fond of tutorial videos but in this case; they get the job done).
What I love about the “Video I: Getting Started” is the fact that it builds up from scratch. So watch this video when you want to know about ant-files/xml, how to open the ANT-View, how to open/execute an ANT-file.

The second video (Video II: Compiling a SWF) was what I really was looking for: how to export a SWF. Very nice because it starts from scratch.
And it gave me the answer I was looking for: why didn’t my ANT-file didn’t work (it about 3/4 of the video):

[blabla]\source\a\example\build\build.xml:17: Problem: failed to create task or type fdt.launch.application
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any / declarations have taken place.

Solution is very simple, but if you don’t know, you will hate FDT and really it’s not it fault:
Goto the green “play” button with the brown bag, in the toolbar (one picture says more than a thousand words:)

Select the ANT-file you want to change (I have only one :D), goto to tab “JRE” and change the Runtime JRE to Run in the same JRE as the workspace and your done:

Very useful are the ANT-snippets and ANT-Build-template!
Download (created by Alan Klement) and “install” the ANT-template (how-to on this page but here the short version)

To add XML files templates go: Preferences > XML > XML Files > Editor > Templates and click import.

To add Ant snippets go: Preferences > Ant > Editor > Templates and click import.

I haven’t seen the second part of this tutorial: FDT and ANT | A User’s Guide – Part II but I will.
It seems to be focused on the use of the templates and snippets.

FDT and ANT | A User’s Guide – Part I
FDT and ANT | A User’s Guide – Part II

FDT Flash

Missing in FDT after working with FlashDevelop

I love FlashDevelop but moved to FDT (read my other post about this subject)…
Not an easy thing (the biggest problem is that it totally not intuitive ) to do and I’m missing some stuff that I had in FlashDevelop.

CTRL+U to change the selected text to uppercase

Update #1: I have found it:
ToUpperCase = CTRL+SHIFT+X
ToLowerCase = CTRL+SHIFT+Y

CTRL+SHIFT+1 to “Promote member to class”

(there is a similar way to do this in FDT but not the same)

CTRL+SHIFT+Q to create a block comment
It is in FDT but I can’t get it to work so you have to work with CTRL+7 (toggle comment) which is a minor adjustment.

The auto-completing FlashDevelop is awesome!! With some tinkering (info here) you can get FDT in the same room but it’s still not the same. I’m used to write private variable with a prefix “_” (example: _variableName). When I want the variable name to autocomplete in FlashDevelop I just type variableName (without the “_” prefix because it stupidly positioned on the keyboard) and it will find it. In FDT you need to start with the prefix “_” otherwise it will ignore the variable name… why???

Also missing: Explore (Open “Project Manager” and right-click on a folder)
(can’t find it in FDT)

But I shouldn’t complain, there is a reason why I’m changing to FDT

Big plus from FDT:
CTRL+SHIFT+F to Format code which is not possible in Flashdevelop
SWC Browsing is limited in FlashDevelop
Cross Platform: FlashDevelop works only on Windows
Refactor: this is so awesome (and expensive!!!)



Moving from FlashDevelop to FDT

Yes, its time, I need to…
So how to make the transition from FlashDevelop to FDT as easy as possible?

Let FDT react like FlashDevelop

And I don’t even have to break a sweat: the amazing Steven Sacks (creator of Gaia) wrote an article about it: read here.
The only two thing that I’m using are:
Open Window > Preferences

Under FDT > Editor > Code Assist copy and paste this into Auto activation triggers for AS, and set the delay to 0ms (zero).

abcdefghijklmnopqrstuvwxyz_. :


Under Problems > AS3 Problems:
Unresolvable > Unresolvable variable reference in E4X and Unresolvable member reference in dynamic object should both be set to Disabled (from Warning to Disabled).

The shortcuts I just left them as they where: I’m working in another program so I should use the shortcut given by that program.

Update #1: hmmm I noticed that I can’t live without CTRL+ENTER…. explanation here: Using CTRL-ENTER to compile ActionScript code in FDT. So now I have CTRL+ENTER and debug run: CTRL+SHIFT+ENTER ๐Ÿ˜€

short explanation (so I can do this quickly if something happens to FDT):

Under Preferences > Run/Debug > Launching at the bottom at Launch Operation: Select “Always launch the previously launched application


Under Preferences > General > Keys find (or type in “type filter text” – searchbox: “last”) a command called “Run Last Launched” and click Copy Command. Assign (binding) the shortcut CTRL-ENTER to the copied command and change “when” to Editing ActionScipt Source (no spelling mistake: it really says that) Editing ActionScript Source.
Do the same thing for the “Debug Last Launched” command and assign the shortcut : CTRL-SHIFT-ENTER and change the when to Editing ActionScipt Source.

I’m not sure if the stuff I wrote here is only for FDT4 but the way it was explained on the site previous mentioned didn’t work in FDT4

Some templates/snippets that are very useful

I used this plugin for my trace in FlashDevelop, so how to do this in FDT?

Update #2: I shouldn’t forget to mention CTRL+0 (read the shortcut list for FDT) which is the shortcut for “Quick Trace”. This one I use to trace variable for example and the trace template below for functions.
Update #4: This is really a reminder for myself, but if you need it you know where you can find it in FDT4.
Some minor adjustments like:

Preferences > FDT > Build Path change Source folders to “source” (I like source above src) and Output folder to “deploy” (I like deploy above bin)

Preferences > FDT > Code Style > Code Templates (Misc) to “Override System UserName – ${user}

Preferences > FDT > Editor goto “Folding” and uncheck “Folding enabled” (I like to see everything, comment also)

Preferences > FDT > Tools > Flash/Flash Help to add paths to Flash (in my case: “H:\Program Files\Adobe\Adobe Flash CS4\Flash.exe”) and the Flash help files (in my case: “H:\Program Files\Adobe\Adobe Flash CS4\en\First Run\HelpPanel\Help”)

Preferences > General > Web Browser change to “Use external Web browser” to my favourite browser: Firefox (no Google Chrome there yet)
You can add any browser that you want.

Update #5: visit and add FTP capabilities to ANT.

You have to create a code-template/code-snippet:
go to Preferences > FDT > Editor > Templates

This is a template that resembles the trace I used in FlashDevelop

trace ( "+ ${enclosing_type}.${enclosing_method}() - args: " + [ ${enclosing_method_arguments} ] );

and I found some other useful templates

Public method:

public function ${methodName}():${type} {
    trace(">> ${enclosing_type}.${methodName}() args: "+[]);

for some strange reason there is no shortcut for asdoc ๐Ÿ™


 * ${cursor}	
 * @example	
 * @param		${enclosing_method_arguments}
 * @return	 	
Update #3: (sadly if there are no param in the function “${enclosing_method_arguments}” will be printed..)

a switch a use a lot with FlashDevelop:


switch (${value}) {
	case ${result}:
		trace ("${result}" +${result} );
        trace("case '"+${value}+"':\r\ttrace ('--- "+${value}+"');\r\tbreak;" );

and the template for a singleton

Singleton: (from gskinner)

package ${enclosing_package} {

	* @author ${user}
	public class ${enclosing_type} {
		private static var _instance:${enclosing_type};
		private static var _allowInstantiation:Boolean;

		public static function getInstance():${enclosing_type} {
			if (_instance == null) {
				_allowInstantiation = true;
				_instance = new ${enclosing_type}();
				_allowInstantiation = false;
			return _instance;

		public function ${enclosing_type}():void {
			if (!_allowInstantiation) {
				throw new Error("Error: Instantiation failed: Use ${enclosing_type}.getInstance() instead of new.");
	} // end class

} // end package

enough for now, here some other posts about the subject


AS3 Flash

My first AIR app: SWF2GIF-banner – part 1

Sometimes, and I’m not very fond of them, I need to make banners…..
The animation part is not so bad, but making the different sizes…. that can be a drag.
And after you made the SWF banners, you also need to make the animation in GIF.

This is how I use to do it:

  1. make the SWF banner
  2. embed it in a html page with a background color that is not in the banner itself (a border around the SWF banner helps)
  3. make snapshots of the animation
  4. open photoshop >> (I used a action for this part….)
  5. place all the images in one document
  6. cut the browser from the screenshot
  7. select the background-color reverse the selection and cut
  8. make a animation from all the layers (end photoshop action)
  9. save

I have never made an AIR application but I think that it should be possible to make a SWF2GIF converter in AIR.

Stuff what I need to find out:

  • browse for a file
  • load that file into air
  • take snapshots of the animation
  • controle the frame rate of the animation
  • make a animated gif
  • save everything
  • etc.

Lets start with some basic:
I’m still working on CS3, and it seems that AIR default is installed with CS4
Installing the Adobe AIR update for Flash CS3


You can also use FlashDevelop 3.0.1, AIR is also installed with that program and in combination with Flex sdk you don’t even need Flash.

Because I’m not finished with it (I will only work on it when I have to build banners) I will post now and then some parts of the code.

For some reason I couldn’t find the code to load SWF into AIR using “browse”.

[as light=”false” wraplines=”true”]
private function openSwfFile(e:MouseEvent = null):void
var imagesFilter:FileFilter = new FileFilter("Flash SWF", "*.swf");
myFile = new File();
myFile.addEventListener(Event.SELECT, selectHandler);
myFile.browseForOpen("Open", [imagesFilter]);

private function selectHandler(event:Event):void
myFile.removeEventListener(Event.SELECT, selectHandler);

private function loadSWF(inName:String):void
trace( "Main.loadSWF > inName : " + inName );
mLoader = new Loader();
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
mLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorComplete);
mLoader.load(new URLRequest(inName));
private function onLoaderComplete(e:Event):void { startOnEnterFrameHandler(); }
private function onErrorComplete(e:IOErrorEvent):void { trace( "Main.onErrorComplete > e : " + e ); }

private function startOnEnterFrameHandler():void
// _movie.addEventListener(Event.ENTER_FRAME , onEnterFrameHandler);
just use a button to activate.

I know the code is not complete… and that some classes have strange names… it’s work in progress.

AS3 Flash Open source / Freeware Tools of the trade

FlashDevelop 3.0.0 released

My favorite open source project ever, FlashDevelop has released: FlashDevelop 3.0.0 RTM (English, 4MB) .

I started with coding in the Flash IDE, when I realized that there are better programs to code in I started working with SE|PY (ActionScript 2 only). I really loved that program, but it never made it to ActionScript 3 and so I tried FlashDevelop. I have never regretted it, it a beautiful piece of work and I can’t work without it.
So if your pockets aren’t deep, and want to become a better AS2/AS3 programmer. you should try this program.

The only sad thing is that it’s Windows only.

Flash Misc

Notepad++ opens ActionScript file with Haskell syntax highlighting

Sometimes I open ActionScript files in another editor then FlashDevelop. And in my case this is Notepad++.
Notepad++ has ActionScript syntax highlighting but it seems that it doesn’t detect it.
When I open an AS file it uses the Haskell syntax highlighting, and that is very annoying especially when you open a couple of files and you need to set them one by one to ActionScript.

Google (who else) provided the answer: here.

This is what you do:
find and open the langs.xml file
you can find it in the install folder of Notepad++, in my case
C:\Program Files\Notepad++

find the haskell language
< Language name="haskell" ext="hs lhs as las" commentLine="--" >

and remove “as” from the ext and save the file.

Next time you open an AS file with notepad++ it will be highlighted in the correct syntax


AS3 Open source / Freeware Tools of the trade

TextMate AS3

I’ve been using a code-editor for years now. I started with SEPY and now I’m using FlashDevelop. Both on Windows.
A colleague of mine still uses the Flash IDE (on a mac), so I decide to help him with his transition.

Sadly there is no free editor for the OSX that handles AS2/AS3, but TextMate is not very expensive and very lightweight. So I decide that TextMate would be the programme that would get him out of Flash IDE editor.

With a little help of Google (I haven’t used a mac for about 7 years) I found some help/instructions that are easy to follow. Sadly it didn’t work while I followed the instruction to the letter.

While you start reading the post below, start downloading Flex 3.2 SDK, it’s 118Mb but you’ll need it later on so why not start downloading it now.

Start reading here: textmate actionscript 3 and flex bundles, it’s about the files you will use. But besides being informative, I needed more help.
I found that here: setting up a as3 project in textmate, the same steps will be followed here

  1. Download Textmate (duh), if you want to test this, use the trail version.
  2. Download Flex 3.2 SDK and extract it into your Developer/SDKs folder (but there are more places where you can extract it: just read this, for example /Applications/Flex and /Developer/Applications/Flex is also allowed)
  3. Subversion: follow the instructions from the tutorial: its very easy (read also the note at the bottom of the post)
  4. ActionScript 3 bundle from subversion: I can repeat myself: follow the instructions (to get the Terminal: Apple + space and type Terminal and get it from the list)
  5. This you don’t have to do: in the new Flex 3.2 SDK it’s already included
  6. I didn’t install this either and it worked just fine
  7. It seems that this is not necesarry anymore (perhaps there was an update of the AS3 bundle…). But if you need it: Follow the instructions, but for the TM_FLEX_FILE_SPECS src/ and TM_FLEX_OUTPUT deploy/Main.swf I needed some help because what ever I did, I couldn’t get the described window.
    I found my answer in this:

    That’s a little hidden. With nothing selected in the project drawer, click on the little i at the bottom. You’ll get a box to enter any variables you want for the project.


    And this one was very frustrating: TM_FLEX_PATH Developer/SDKs/Your Flex SDK Folder: this one needed an extra slash TM_FLEX_PATH /Developer/SDKs/Your Flex SDK Folder and in my case it was TM_FLEX_PATH /Developer/SDKs/flex_sdk_3

    Note: Some of this is not necessary when you create a project instead of separate files: File >> New From Templates >> Actionscript 3 >> Project. Just check TM_FLEX_PATH if you installed flex in file that standard is read by Textmate. If not you need to fill it as described above (I needed to do that)

  8. The same as in the tutorial
  9. The same as in the tutorial
If you extract the Flex SDK, you will get a folder named “flex_sdk_3” and the very observant reader will notice that the script used here doesn’t include the path “Developer/SDKs/flex_sdk_3“, so that is the reason you need to add it to the “shell variables” (number 7). You can also rename the folder to “flex_sdk_3.2.0” and then I don’t think you need to add it to the shell variables, but I haven’t tested it!

Some extra information: svn is something that not everybody will use. So if you have no idea what it is, the bundle can also be installed without subversion. But the cool thing about subversion stuff is that it’s always up to date… (And I can’t help you with how you should fix it without svn)

Every blog mentions the price of Textmate: “single user license (€39 ? $53)”. That’s not expensive; unless you live in the Netherlands: “single user license (€48.75)” because we need to pay “Prices above include 25% VAT.” ๐Ÿ™

Links in this tutorial:
textmate actionscript 3 and flex bundles
Flex 3.2 SDK
installing as3 and flex bundle for textmate.
flex and actionscript 3 with textmate and fcsh

AS3 Flash Open source / Freeware Tools of the trade

FlashDevelop 3.0.0 RC2 released

I said it before: I don’t like to regurgitate, but program is so good that I can’t help myself….

As we are now approaching the final release of FlashDevelop 3, this release is the last feature release. – View topic – FlashDevelop 3.0.0 RC2 released.

FlashDevelop is awesome! If you never used it, give it a try. And don’t be afraid that it’s not a final version: I’ve been using release 3.0.0 from the early beta, and never run into major bugs.

FlashDevelop documentation

AS3 AS3 migration Flash

Document Class in AS3

A while back a read this post about the AS3 Pills #1 – Document class and it reminded me to write something about the “Document Class”. The title of this post is a little misleading: there is no “Document Class” in Actionscript 2 but this is probably the way you are searching for this problem.

A good explanation can be found on which has a ton of examples, explanations and tutorials!

But this is what it comes down to:

  1. create a folder with the name “Matthijs tutorials” (or use your own name, it’s not important)
  2. create in the folder “Matthijs tutorials”, another folder “source”
  3. save a flash file in the “source” folder: “documentClassTest.fla”
  4. now we start making packages: create a folder “nl”
  5. and save in folder “nl” a folder “matthijskamstra “
Folder structure (FlashDevelop)
Folder structure (FlashDevelop)

Goto Adobe Flash, and create a AS3 Flash file and save it in the source folder.

Fill in the document Class: nl.matthijskamstra.Main
(Flash will complain somewhat, you can ignore it for now…)

Document Class
Document Class

Create a new class in the folder matthijskamstra, default (at least the default Flashdevelop class) it will look something like this.
package nl.matthijskamstra {

* @author Matthijs Kamstra aka [mck]
public class Main {

public function Main () {


} // end class

} // end package

If you would compile the .FLA now you will get an error (Compiler Errors):

Location:, Line 1
Description: 5000: The class ‘nl.matthijskamstra.Main’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

(if you compile using flex you will get this error)

Error #2023: Class Main$ must inherit from Sprite to link to the root.

The first time I got this error I couldn’t understand it, luckily I do now and the answer isn’t that difficult, but if you don’t know… ๐Ÿ™

  • The class ‘nl.matthijskamstra.Main’ must subclass ‘flash.display.MovieClip’: the class that we just made needs to extend (be a subclass) of Movieclip (the root has a timeline)
  • since it is linked to a library symbol of that type: this is strange, this says that the class is linked to a library symbol. This what puzzled me the most: I (we) didn’t link this to a library item, we linked it to the document class. The Flex error helps more, but you can see the root as a very big movie (timeline) and let the error be the error.
  • Error #2023: Class Main$ must inherit from Sprite to link to the root.: why does flex say you need a to extend Sprite? Flex programmers don’t use the timeline and a Sprite is a Movieclip with just one frame.

So to sum things up: there are some stuff that you need to do with a document class that you don’t have to do to an other class:
First you need to extend it to Sprite or MovieClip. If you create more then one frame in the timeline you need to extend to MovieClip because MovieClip supports frames and Sprite doesn’t. I always choose to extend to MovieClip, because it covers all the bases… (a Sprite is a MovieClip with just one frame: a Sprite is not a MovieClip but a MovieClip is a Sprite)

Another error that seems to happen sometime (not if you use the default class from FlashDevelop)
Second a document class should be public (the constructor is always public).
A Constructor is a function or method that is called whenever the Class (in our case the document class) gets instantiated, it must never have a return type such as “void”

Don’t forget you need to import the MovieClip class: import flash.display.MovieClip; (see the error created by Flash)

So the Document Class looks now something like this:

package nl.matthijskamstra {

import flash.display.MovieClip;

* @author Matthijs Kamstra aka [mck]
public class Main extends MovieClip {

// constructor
public function Main () {
trace( “Main.Main” );
init ();

private function init ():void {
trace( “Main.init” );

} // end class

} // end package

Export you Flash file and you will have two traces in you output panel

My default class looks similar, I add two group-imports:

import flash.display.*;

with the “*” you import everything in that package (MovieClip, Sprite, etc)
because AS3 is event based, I import everything in the events-package

package nl.matthijskamstra {

import flash.display.*;

* @author Matthijs Kamstra aka [mck]
public class Main extends MovieClip {

// constructor
public function Main () {
trace( “Main.Main” );
init ();

private function init ():void {
trace( “Main.init” );

} // end class

} // end package

That’s it, I hope this clears the mystery called Document Class
Questions? You know where to place them!

another post that I never finished, but it fits here…

Andrew Paul Simmons: Blog: ReferenceError: Error #1056: Caused by Declaring Stage Instances Private.

Ever got this error: ReferenceError: Error #1056: Cannot create property? No, then someone has explained it to you before you made this mistake.