PDA

View Full Version : Where to start with AS 2.0?


Malignus
05-19-2007, 07:50 PM
So, I tried using Macromedia's LiveDocs on basic AS 2.0 to create a really basic turn-based combat engine the other day. It completely failed. Part of the problem, I think, is that I don't quite understand how it works.

I know that you've got AS files in the same directory as the FLA, that you name the class each AS file creates the same thing as the file name, and that you stick a little bit of code in the FLA to create an instance of the class.

What I don't quite get is, what is happening when you create an instance of a class? Should you be trying to stick functions in your classes, or should you only be creating sets of variables that you then manipulate with functions inside the FLA? How do you match up these variables in a class instance with an actual movieclip you want to attach to the stage? This seems like it ought to be really obvious and basic, but unfortunately livedocs has failed utterly to properly teach this stuff to me. Maybe I'm just dense, and if so, I'll own up to that. But really, I'd just like a nice, comprehensive tutorial. Is there one somewhere?

Jacob
05-19-2007, 08:19 PM
Kirupa.com has some tutorials (http://www.kirupa.com/developer/flash/index.htm). One specifically on OOP in AS2 (http://www.kirupa.com/developer/oop2/AS2OOPindex.htm). Theres a list of some other resources at Kongregate (http://www.kongregate.com/forums/4/topics/89?referrer=arcaneCoder)as well.

Your classes should contain methods and variables specifically for that particular class's use. For instance, all instances of the MovieClip clip have the property _visible and the method hitTest() , so you can access those from any mc instance: myClip._visible / myClip.hitTest(), etc. Its the same principle, except you can create and extend you own classes other than just MovieClips or BitmapData, etc.