Setting up a package for your flash traditionally means that you will be going in the direction of object oriented programming. This means that you will be able to create different class files and use them as objects.
The simplest way to look at this is using any general object such as a city. In order for the city to be properly run we will need an object for power grid, roads, and sewer system. These sub objects can be split up into their own classes and used in the main movie clip by setting up a package.
The basic package layout looks something like this:
1 2 3 4 5 6 7 8 9 10 11 12 | package { import flash.display.MovieClip; public class Main extends MovieClip { public function Main(){ trace("If this appears in the output you have done well."); } // end of main function } // end of main } //end of package |
Tip: When creating a swf object you need to make sure that you do not mix together AS1 and AS2 with action script 3. This is unlikely to happen if you are learning from scratch or teaching yourself but if you need to update a previous project then you will need to make sure you are not mixing levels of actionscript. This is caused by the way they are put together in the creation of the swf file.
Inside of this file you can add all of your movie clips and declare them as variables. You can also import all of the needed files along with create the code required to do what you would like to do.
The last thing that is required when creating a package is the link to your movie clip. You can create this link simply by clicking on the stage, making sure it is your default document, then adding the document class name as shown below.

If everything is ok and your flash program runs you will have a line of confirmation in the output.

