4 Replies Latest reply on Nov 29, 2012 6:41 AM by FrostByte1995

    Tic Tac Toe help!

    blazah99

      I'm working with AS2 to build a tic tac toe game learning the language from a book I have, however I have reached a point where its not working and I don't know what to do and why its doing what is it.

       

      I have it setup so that when it reachs the "gamePlay" frame it stops and draws the tile properly but when you play it only changes the last tile. Additionally I can not seem to trace the output for the variables I created in a nested "for loop".

       

      If you can please help!

      https://www.dropbox.com/s/brldvn60nx4rmwt/TicTacToe.fla

        • 1. Re: Tic Tac Toe help!
          Ned Murphy Adobe Community Professional & MVP

          People generally will not download files in these forums.  You are more likely to get help if you present your case in your posting, including any relevant code, and explain where the problem areas are with it.

          • 2. Re: Tic Tac Toe help!
            blazah99 Level 1

            OK I'll try.

             

            I am using a single movie clip for th tiles(blank, x, o), one movie playerX, and one for playerO. I'm using code to draw the tiles and change them accordingly.

            My struture is:

            function init()

                 drawTiles()  //working

                 traceTiles()  //not working at all

                 clickEachTile()  //not working correctly

             

            function drawTiles()  //I think this is all working...

                 -nested loops

                 -create tile: attachMovie()

                 -position tile

                 -make tile start blank

             

            function traceTiles()

                 -nested loops

                 -onRollOver

                      -trace tile name

             

            function clickEachTile()

                 -nested loops

                 -onRelease   

                      -set state for that tile  //X or O

                      -turnTile(tile,state)

                      -switchPlayers()

             

            function switchPlayers()

                 -dim current player

                 -highlight other player

             

            function turnTile(tile,state)

                 -make tile appearence  //X or O

                 -traceStates()

             

            function traceStates()

                 -nested loops

                 -trace states of all the tiles

             

            Since I get no errors and no output the problem I think is somewhere dealing with the attachMovie, onRollOver, or set state for that tile.

             

            Additionally after further investigating I found that I can not use the Action's Window's "Auto Format" because of two errors. It expects a '{' on a line which has it however quadruple checking it looks to be correct without and it has the proper number of closing '}'s. The other is a syntax error I get on the very last line no matter what I do to correct or delete it, it just movies up to the previous line.

            • 3. Re: Tic Tac Toe help!
              Ned Murphy Adobe Community Professional & MVP

              If you won't show the actual code you can't expect much feedback.

              • 4. Re: Tic Tac Toe help!
                FrostByte1995

                if you want you can use frame by frame and set each one in its own frame.