The Flash application that I chose to migrate is an online Sudoku game. The application loads new puzzles from an XML file or from external resources. You can select the level of difficulting using a slider control. By clicking the Pause button you can change the source of the puzzles and the size of the hints, while the Check button reveals any errors in your potential solution (see Figure 1).
The original code is very clean. The developer followed best practices when building the Flash application. Each functional component is contained in a class file, and the classes are loosely coupled, so I didn't need to read and understand all the code to start building the application on AIR.
Note: When classes are loosely coupled, the developer has minimized the dependencies between classes, and as a result, reduced the risk that a change in one module will force a change in another module. The loose coupling of classes in the original Flash application made it even easier to migrate the application to AIR.
I made only one change to the structure of the original application: I removed all the code from the first frame of the SudokuPuzzle.fla contained in the Sudoku_as3.zip and put it in the document class of the AIR application, sudoku.Main (see Figure 2). I made this change in order to keep the code outside of the FLA file, because I prefer to maintain a high level of separation between the buisness logic of an application and its GUI, and because I have implemented some events to enhance communication between classes (I always define the listener for these events as private members).

Figure 2. Definition of the document class.
Note: All the changes I made to the code to convert the Flash application to AIR are marked as follows in the sample code that accompanies this article:
The structure of the original application is quite simple—each class represents the UI elements or the logic used to create the puzzles at runtime (see Figure 3).

Figure 3. Application structure and classes.
As I converted the application to AIR, I wanted to improve the desktop experience by adding the following capabilities:
To accomplish this, I needed to work on two classes: Main.as and PuzzleLoader.as.
In the original application the options panel is used to set the new puzzle download preferences (see Figure 4). This is the option I'll update in AIR for an online and offline game experience.

Figure 4. The original Options panel.