Flash for Free
Page 2 of 5
<1 | 2 | 3 | 4 | 5>
Single-page view
Flash for Free

2. Your development environment

There's a universal consent that part 2 is by far the most boring, and people are tempted to pull an Underpants Gnome trick (don't ask) and go carefully through steps 1 and 3 while leaving a big set of question marks over 2.

Please don't skip this section. Your programs will screw up, you'll fail to compile properly and the world will explode. Worst of all, you won't fully understand why all this happens, and many, many programming woes emerge purely because the user doesn't know what's going on.

Right, go ahead and open FlashDevelop. Then take a moment to pause and read through the next few paragraphs before doing anything else.

There's a few things that need to be set up in FlashDevelop before you even open an AS3 project. First off, look for Tools in the menu bar and proceed to Program Settings. Select the AS3Context plugin and scroll down to the "Flex SDK Location" field. Now, remember earlier when we extracted the SDK files onto the hard disk? Type that location into the text field, or click on the ellipsis (three little dots) and browse for it. Hopefully you haven't done something stupid, like forgetting where you extracted those files to. If you have, slap yourself on the face and go back to step one. Everyone else, congratulations! You've just told FlashDevelop where the SDK is. Now it can actually figure out what to do with the code when you click that big green "GO!" button.

SDK location
SDK location

For beginners who aren't familiar with this concept, take note: FlashDevelop is just a development environment. This means that it can watch your code, help you auto-complete, and generally provide a comprehensive structure to organise and streamline your development experience. But it cannot, and never will, be useful in debugging, compiling, interpreting, linking, running, fishing, baking or writing philosophy essays. It needs the SDK for that stuff in the same way that a really awesome refrigerator can provide shelving and storage for your food but won't ever prepare dinner for you (unless you count the stuff that always grows right at the back). If you try make a Flash program without an SDK present, you'll come short very, very quickly.

A secondary, albeit slightly less critical action to perform is establishing a folder on your hard drive for all of your Flash projects. After all, your projects don't consist of one or two arbitrary files that can just be shoved anywhere and recognised easily. They're entire directories (and sub-directories) of project shortcuts, source code and embedded files which all contribute to your final product, and it's preferable if you don't just shove them into the mess of C:\various_rubbish. So go ahead. Create a nice neat "Flash Projects" folder somewhere on your drive. You'll thank me for it later.



Words from the readers
thanks a lot for this wounderful tutorial
Posted by Kadri at 19:19:06 on 01 July 2010
Thank you so much for this article!! I would have gone crazy trying to figure out by myself how to get started. You are an angel! Thanks again!
Posted by Rafael at 22:43:47 on 29 June 2010
This is awesome .. Thanks ..
Posted by Nat at 03:29:41 on 29 April 2010
Hello.

Thanks for the tutorial and all, but I've downloaded the SDK and I point the FlashDevelop language settings to that folder, but it never <i>retains</i> it (after restarting). This is actually the problem that led me to your tutorial in the first place (FD's documentation site is rather terse, so I thought maybe I was missing something -- well, actually, I'm obviously missing something; I've just no idea what it may be). It <i>is</i> the <i>folder where the SDK resides</i> that I'm supposed to point it to, correct? It currently resides in a folder entitled "flash projects" on my desktop (WinXP) -- that is, the folder entitled flashsdk_whateverversionitis_orwhatever, with all its requisite extracted flashy SDKness.

Thanks for any helpful enlightenments you can provide.
Posted by Jordan at 17:06:22 on 24 April 2010
I've already done following your procedure. But I've got build fail.

thanks,
Posted by James at 09:19:24 on 31 March 2010
Awesome Tut! I'm a completely wet-behind-the-ears FlashDevelop (let alone AS3) newbie and THIS is totally the right start. It's also a lot easier to follow than the FlashDevelop installation notes & guidelines.

Thank you!
David M.
Posted by David M. at 08:55:50 on 28 March 2010
Hey this is really great! Easy to follow and does exactly what it says on the tin! Hopefully you'll do more of these, since most tutorials seem to be geared towards people developing in Flash CS3/4
Posted by falconi at 06:38:37 on 27 December 2009
I read through the whole thing but there was no As3 project at all so clicked default. there is no init() though so I was unable to get the project to run
Posted by mark at 07:06:13 on 18 December 2009
Thank you so very much for your help. I just needed a simple startup for learning actionscript with flashdevelop and so many sites had, well I had issues with so many sites. Thank you for your help again! I will email a company in a couple of days and say I just learned actionscript! Well I just needed to get it running. It seems like many other languages and so this gets me going! Sorry, blabbing.

Posted by seanmarillion at 02:21:56 on 08 November 2009
Ooh, missed that comment! Thanks, it's a good idea. I've made one or two minor changes in the article to remove ambiguity in these cases.
Posted by Nandrew at 15:16:12 on 24 September 2009
This tutorial is amazing! Furthermore: you should include the doubts presented in this comments thread in the tutorial itself, because i had the same problems as the other two guys.
Posted by Nek at 17:58:24 on 13 September 2009
Hey Jim!

The screenshot you're referring to chops off the top line: you need the word "package" on its own line, as well as an extra opening and closing brace to surround everything. If you're still having problems after that, I suggest you just use the base code template that FlashDevelop *should* offer you (that's what this article assumes as given), and simply insert the lines circled in red.

Hope that fixes everything -- let me know if you're still struggling, I'll check these comments for updates.
Posted by Nandrew at 22:12:59 on 20 August 2009
Thanks for this article - I found it really useful.

I ran this code - which seems to be the same as on your screenshot:

import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;

public class Main extends Sprite
{

public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init (e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);

var myText: TextField = new TextField();
myText.text = "Hello Flash";
stage.addChild(myText);
}
}

But when I built the project, I got this error:

C:\DATA\My Documents\_jim\flash\FlashDevelop\src\Main.as(5): col: 1 Error: The public attribute can only be used inside a package.

I wondered if you might be able to advise please?

Thanks!
Posted by Jim at 09:49:30 on 19 August 2009
This may or may not have a simple solution.

I *think* you may have accidentally produced your code inside a source file other than "Main.as". When FlashDevelop starts a new project, it typically opens up a code window called "Untitled1". If you don't double-click on Main.as from the right-hand panel and work in that instead, you'll be coding in a file that never gets called by the program!

I strongly suspect that this is the problem: your code itself is fine, since I copy-pasted it into my dev environment and it displayed the text properly. If there's still a problem, double-check the IDE settings outlined in this article. The Flash version given in the example is by now a bit out of date, but the advice should still apply.
Posted by Nandrew at 02:15:47 on 13 July 2009
This is a very helpful article but when I try to run it it shows up blank any advice? Here is my code:
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;

/**
* ...
* @author ****** ******
*/
public class Main extends Sprite
{

public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
var myText: TextField = new TextField();
myText.text = "Hello lash!";
stage.addChild(myText);
}

}

}
Posted by Ace Fire6 at 14:50:22 on 11 July 2009
Thanks! If you're interested in reading further into Flash, don't pass up the opportunity to head over to http://www.gamepoetry.com/blog/ -- it's a very useful blog with some very useful articles, and served as a major inspiration for this piece.
Posted by Nandrew at 18:22:49 on 06 May 2009
i have looked all over the web and this is the best of them all for a beginner
Posted by xraser at 13:35:19 on 06 May 2009
Have your say: