3

Am self teaching myself actionscript 3, I read through some tutorials and understood the code perfectly, the problem lies in how to run it, I know some programming languages and I used some IDEs i over the years, but for some reason I just can't figure out how to compile and run simple actionscript programs in CS5.5.

Can anyone please tell me how this can be done with flash pro CS5.5, is there another program more akin to netbeans or eclipse that I can write actionscripts and run them??

Thanks

Sam
  • 43
  • 1
  • 3
  • If you're on Windows, I can recommend [FlashDevelop](http://www.flashdevelop.org/). Just create a new ActionScript 3 project and you're ready to develop! –  May 08 '11 at 19:50
  • I will check it out, thanks...does it have any missing features that arent in flash pro 5.5?? – Sam May 08 '11 at 19:52
  • 3
    FlashDevelop is a pure AS3 IDE. It is only for writing code. You do not have the graphical layout of an fla file there. You can import an fla file into a FlashDevelop project, though! It's really better if you use FlashDevelop and Flash 5.5 together (FD for the fact that it's an amazing code editor and 5.5 because of the ability to use the fla format for animations). – scriptocalypse May 08 '11 at 20:58
  • 1
    I've tried a number of code editors out, including pretty complex IDEs like eclipse or netbeans, and FlashDevelop is the best of them (for flash, at any rate). +1 to maskedMan. – Bosworth99 May 08 '11 at 21:26

2 Answers2

7

The piece you're missing is the ability to tie an .as file into an .fla to serve as the main, or Document, Class.

You can set the Document Class in the properties panel of an .fla file.

For a quick sample:

1) Create a file called MyDocumentClass.as, which should be a pretty simple AS3 class file. The class name would be MyDocumentClass. That should look something like this:

package {

import flash.display.MovieClip;

 public class MyDocumentClass extends MovieClip {

  public function MyDocumentClass():void {
   trace("It worked!");
  }
 }
}

So far so good?

2) Now open Flash CS5.5 and create a new .fla. Save that .fla in the same folder that you saved your Document Class. You should have nothing on the stage - find the properties panel. There should be a text input box with the label "Document Class" - simply type "MyDocumentClass" into that text field, then compile your .fla. You should get "It worked!" traced out.

Basically, when you're working on a complex AS3-based application but want to use the Flash IDE for graphics or whatever, your job is to link up symbols to classes in the library. The class for the whole FLA is the Document Class, which is why you link that up in the properties panel for the whole .fla.

When you are rolling in CS5, you will eventually start creating MovieClips that live in your library. You can right-click one of those at any time and look at your properties. Select "advanced" and you should get the option to "export for AS3" - click that, then you can make it so that that symbol either extends a base class or simply ties into a class. Once you start playing with it it should start to make sense - hopefully, though, steps 1 and 2 above will be enough to get you rolling.

Good luck and have fun!

Myk
  • 6,205
  • 4
  • 26
  • 33
  • thanks for the instructions Myk, I will go over them later today, hope everything works out well, for what am seeing flash development seems alot more fun than C++ or java, so hopefully its a start of a good thing =D....if i have any further questions i will make sure to post them here... thank you guys :) – Sam May 08 '11 at 21:45
1

Skip the tutorials. Every AS developer should have a copy of Essential ActionScript 3.0. Read it, and work through the examples in your environment.

While I like FlashDevelop, I don't think the Flash IDE is as bad as most say it is. I find it a lot quicker in early stages of development to just use the IDE, especially when I have a rough FLA from a graphics person and I have lots of class assignments to make in the library, and have to rework structure to better fit requirements. I will admit, though, that since I learned how to program w/o an IDE, my opinion is a bit skewed.

mpdonadio
  • 2,891
  • 3
  • 35
  • 54