If you're on Winblows, I recommend getting FlashDevelop for writing AS, it's a lot nicer than the Flash IDE. It even autoimports required classes if it detects a class missing.
On flash, set the document class to "in the properties panel" to "MainClass." Create a new AS file in the same directory as the (*.fla) / (*.swf), name the file "MainClass.as" and append to this to the file:
package
{
import flash.display.MovieClip;
public class MainClass extends MovieClip
{
public function MainClass():void
{
trace("It's working!");
}
}
}
package acts as the directory structure in relation to the fla / swf. the method "MainClass" works as a constructor for the "MainClass."
Hopefully that helped you out!