Importing classes and declaring first variables
The first thing we need to do, as usual, is set up the project and define the main class and function, as well as preparing the game field.
Create a new file (File | New) then from New Document window select Actionscript 3.0. Set its properties as width to
400 px, height to
480 px, background color to
#333333 (a dark gray), and frame rate to
30 (quite useless anyway since there aren't animations, but you can add an animated background on your own). Also, define the Document Class as
Main and save the file as
tetris.fla, create a new file and from New Document window select ActionScript 3.0 Class. Save this file as
Main.as in the same path you saved
tetris.fla. Then write: ...