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
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!