chapter  15
Pages 19

The strategy used to store the paths is to assign a number to each exit: North will be 1, South 2, East is 4 and West is 8. If a cell has no paths then the value stored for this cell will be zero. If a cell has four paths then the value stored will be 15. Table 15.1 shows all the possible values. Because a path can either be on or off, choosing powers of two to provide the value for a column ensures that we have enough information to store every possible value. If a cell is the entrance then we will add 16 to the value and if the cell is an exit we will add 32. To create a maze we need to generate the values for each cell and store this in a MIME-encoded form so that we can easily load the variable values into Flash. To do this we will create a

The maze maker program, ‘Examples\Chapter15\mazeMaker.fla’, contains a Movie Clip called ‘cell’. This has 13 frames to represent the 12 different possible values for the paths coming into a cell and an extra frame to allow for looping back to frame 1. The clip contains a transparent button, a button with only a hit area, no graphics. The one release action for the button is to step to the next frame; on frame 13 the playback head is set to frame 1. The maze maker program also contains input boxes to set up the number of rows and columns in the maze. There are three command buttons and a Dynamic Text area.