Source Code and Comments

We provide here complete source code for our PeekAMaze free Android app that you can download and install from the Android Market. Open the Android Market on your phone, search for flashandmath, and locate PeekAMaze on our apps list. You can then download and install the app.

The app is a new and interesting twist on the classical maze puzzle. The purpose is to find an exit out of a maze but at each point you can see only a portion of a maze. You have an option of 'peeking' at the maze by dragging it in a view window. You can peek and try to remember your way out but the number of 'peeks' is limited. There are several levels of difficulty. At each level, a practically unlimited number of mazes can be generated using our custom AS3 classes, including a perfect maze generator. The AS3 classes and the complete source code can be downloaded from a link under the screen shots.

Download

Working with the Source Files

The zip file contains PeekAMaze.fla file and a folder of custom AS3 classes: com -> flashandmath ->*. PeekAMaze.fla file was created from AIR for Android template that becomes available in your Flash CS5 after you download and install AIR for Android Extension for Flash CS5 from the Adobe site. See our Android example AIR for Android Application KaleidoscopeFM - Source Code for useful links how to get started with AIR for Android in Flash CS5. Of course, if you have Flash CS5.5, the AIR for Android template comes with it.

After you open PeekAMaze.fla in Flash CS5, you must enter AIR Android Settings and set those again in order to be able to play with the application and have it install on your phone for testing purposes. In this case, the settings are simple.

Under General, make sure the app is set to Portrait mode, preferably but not necessarily Full screen.

Under Deployment, create or enter your p12 certificate. Then choose Android deployment type and After publishing settings. With our phone-computer setup, we worked with Device Release, Install application..., and Launch application checked.

Under Permissions, nothing. This app does not require any permissions.

Desktop version of PeekAMaze is coming to flashandmath soon!

Comments

We used our AS3 MazeGenerator and MazeDisplay classes in our earlier rendition of the maze puzzle for Android: AIR for Android MazeFM Application, Cool Control Wheel. The new AS3 element in this new app is dragging functionality.

There are many AS3 classes and events specific to a touch screen environment that we could have used to drag and pan a maze in the view window, in particular, for example TransformGestureEvent.GESTURE_PAN. We opted for staying within the mouse emulator events and use MouseEvent.MOUSE_DOWN, MouseEvent.MOUSE_MOVE, and MouseEvent.ROLL_OUT. We found that, at least on our devices, mouse events work equally well, while being more universal.

We used access to the phone's MENU key and the class NativeApplication to exit the app at a touch of a button. We discussed those in our earlier Android examples, e.g., AIR for Android 'Rolling Cubes' 3D Puzzle - Source Code.

This PeekAMaze app was written by Barbara Kaskosz of flashandmath.

Back to AIR for Android              Back to Flash and Math Home

We welcome your comments, suggestions, and contributions. Click the Contact Us link below and email one of us.

Adobe®, Flash®, ActionScript®, Flex® are registered trademarks of Adobe Systems Incorporated.