For Newbies: Basic class structure -- a game with nothing on the stage
For first time CS3 pro users, it may be a bit of head scratching if you decide you want your game to "just be in the AS file" (ie nothing on the timeline).
This is a template for how to do that.
First off, you need to use a single name FIVE TIMES.
Say your class is called TEMPLATE_01. You'd need:
1. TEMPLATE_01.fla
2. TEMPLATE_01.as
3. name of Document Class in FLA is TEMPLATE_01
4. name of Class (in AS file) is TEMPLATE_01
5. name of first function (in AS file) is TEMPLATE_01
Below is an example of the TEMPLATE_01 class. If you copy the below and save it as TEMPLATE_01.as, then you only need to do step 1 and step 3 above.
Note: for a much more complex example, see the thread
Game Structure regarding classes and objects in Flash
package
{
import flash.display.*;
public class TEMPLATE_01 extends MovieClip
{
//class level vars go here
public function TEMPLATE_01()
{
//this is the default function
trace("Reached line 14!!!");
}
//-----------------------end function
public function XYZ()
{
//this is another function
}
//-----------------------end function
}//end class
//-----------------------end class
}//end package
Copyright Gary Rosenzweig
