Skip to main content
Participant
October 12, 2012
Question

Tic Tac Toe help!

  • October 12, 2012
  • 1 reply
  • 1859 views

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

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
October 13, 2012

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.

blazah99Author
Participant
October 13, 2012

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.

Ned Murphy
Legend
October 13, 2012

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