-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|764|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Coding Basics


 
Jayenkai
Created : 27 August 2008
Edited : 27 August 2008
Language : FastBasic

Half an Hour, Flash/haXe Jumpstart

Make things in code, that run in flash!

You know you've always wanted to do it..


= this...

Now you can.
haXe is a lovely new language that allows you to compile to flash!
Code, Compile, Sorted!

Took me a while to get everything working right, though, so I thought I'd make a nice Jumpstart to get everyone else into it a bit quicker. (And also to remind myself how I did it, once everything goes horribly horribly wrong!)


Step 1 : Download
haXe itself, and FlashDevelop IDE
For future (Oh no, all the updates have caused it to break) reference, the versions I used were..
Note, you'll have to download FlashDevelop IDE 2.0.2, because the 3.x.x ones don't work!


Step 2 : Install
Install the two files you just downloaded. You'd think that'd be it, but it's not!
Open up Command Prompt, and shove in the following..

haxelib install haxefd

which installs the FD(FlashDevelop)->haXe stuff.
and then

haxelib run haxefd "c:\program files\flashdevelop"
(assuming you used the default install path) to do some more install stuff. *shrugs*

With that, you're ready to make your first project! Woot!


Step 3 : CasESenSiTivitY's AnNoyIng

Open up FD
Menu - haXe, New Project
Name your project.

Now, at this point, you might want to write down a few bits of this, or something like that, because when you flip back out of FD the damn window closes on you!
Let's continue..

Menu - View, haXe Files
(Alternatively, you should have 2 tabs on the left.. hover over the one that says haXe Sources to pop it out.)
Rightclick the Project name, New - File.
Name it.
Note : This is really annoyingly case sensitive. I'm 99% certain that the first letter must be a capital letter!
(Didn't seem to work, otherwise!)

Menu - View, haXe Project
(Or again, hover over the tab)
Rightclick the topmost project thingy, and Add Target.
Name it, then click on it to bring up it's properties below.
Make it a flash, ignore most of the rest of the boxes, except..

Class open the file you just created.
Tick the Call main Function box.

Sorted.
That's pretty much your first project ready and raring to go.
But first, we need to put some code in it!

Step 4 : Put some code in it!
Your main window should now hold your project's .hx file.


Shove it in, have a read, and don't forget to change the class names to what you saved yours as.
Press F8 to compile it, then F5 to run it.


Step 5 : Extra Parameters
Open up the properties for the project again (The project tab)
Down at the bottom of the tab, there should be an Extra Parameters section.
Place the following in there.

-swf-header 320:240:30:FFFFFF

This will set up the program to run at 320x240, 30fps, and with a white border.

F8, F5, Test, Be happy!

If you're not happy, let me know below!

If I bother continuing with this, and actually bother to make Jumpstart - Part 2, it'll be all about struggling to get some sprites onscreen

 

Comments


Tuesday, 09 September 2008, 22:22
Evil Roy Ferguso
Flash development was something I had always (well, relatively) been interested in, but I found the development environment rather intimidating for a variety of reasons.

After having read this, I played around with haXe for a little bit and am finding it quite a lot more like what I prefer to work with, and the quickstart did help -- thank you for writing this.