In a few steps I will show you how to create Document Class(MainClass) for your flash project.
First off I will create new flash document with a name _root.fla .

Now I will create my package folders in which I will add my document class named Application.as .

It is very important that the class must be extended like a MovieClip. When we extend our class like MovieClip that means that our Application.as Class is now sub class of the MovieClip Class and this means that the class inherited all properties and functions from MovieClip Class.
Application.as code:
package com.myname {
import flash.display.MovieClip;
public class Application extends MovieClip {
public function Application() {
trace(“Root of our Application”);}
}
}
Now we need insert path of Application.as Class inside of document properties in Document Class Field:com.myname.Application

Now when you test your _root.fla you will see in output this message : Root of our Application
That is that now you are ready to build your application next.