How to create (ActionSctipt) classes for a new project?

Whenever I start a new game, I create a whole bunch of classes that extend the base classes, so:

com.blah.Game extends com.iainlobb.Game and has some setup code com.blah.Player extends com.iainlobb.Player and has some setup code etc.

Now I only need to create these classes at the beginning of the project, so I don't have to create them manually. This will save me at least an hour of cheating per game. So how do I go about doing this? I usually use FlashDevelop, but I also have FlexBuilder 3, or am happy to download any other software I need (PC). Thanks.

+2


a source to share


4 answers


If you are using FlashDevelop, you can create your own project template based on one of the defaults. The templates are in:

Your FlashDevelop Install dir\Projects\

      



A typical template file looks like this, and it shouldn't be very difficult to modify it to extend the underlying structure instead. You can add multiple files to your project template. Not sure about adding imports, although it might be a manual step if you are not more comfortable adding it to every project.

package $(PackageName)$(CSLB){
    import flash.display.Sprite;
    import flash.events.Event;

    /**
    $(CBI)* ...
    $(CBI)* @author $(DefaultUser)
    $(CBI)*/
    public class Main extends Sprite $(CSLB){

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

        private function init(e:Event = null):void $(CSLB){
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
        }

    }

}

      

+1


a source


The SourceMate plugin for Flash Builder and (I think) flex 3 is a great tool and will help a ton of boring stuff - for example, build 1,000,000 classes in a new project.



http://www.elementriver.com/sourcemate/ - It costs money. only £ 50

0


a source


FlashDevelop has a "templates" option that allows you to create classes. Explained here: http://catfacegames.com/2009/01/19/flashdevelop-templates/

First, inside FlashDevelop, choose "Tools> Application Files" from the menu. This should open up an explorer window where you will see several folders. Navigate to the following folders: Templates> ProjectFiles> AS3Project.

Adds options to the context menu. Doesn't add all classes at once, as I originally wanted, though ...

0


a source


Using FDT, it is possible to import Project as a folder tree or zip file in the current workspace. Therefore you only need an empty project archive filled with your classes and linked to your libraries and importing it to create a clone.

0


a source







All Articles