Having really weird problems with "Match 3" game.
I typed in all the code, about 60% of which I think I understood, and, as usual, the game didn't work the first time around. Here is what happens: I click on two pieces in succession, and nothing happens, whether or not the swap is valid. I keep on clicking, and, after a random number of clicks, I get the pieces to swap. However, not only do the matched pieces not disappear from the board, but, from this point on, any two pieces I click on will swap places, whether or not the swap is valid.
I tried locating some of the places in the code where problems might be occurring using "trace" statements. Then I would get this error message:
TypeError: Error #1010: A term is undefined and has no properties.
at MyMatchThree/getMatchHoriz()
at MyMatchThree/lookForMatches()
at MyMatchThree/setUpGrid()
at MyMatchThree/startMatchThree()
at MyMatchThree/frame2()
Sometimes I would delete the "trace" statement and the error would go away; sometimes I would add the "trace" statement back in, and the error would still be gone.
I tried comparing the text of my version of the code with Gary's original code. In some places I found, oddly, that there were "new Array" statements and "new Sprite" statements without the parentheses at the end. So I changed them to "new Array()" and "new Sprite()" and got the above error message again.
Just now, I rebooted Flash and the same file that was producing the error before is no longer producing the error, although I made no changes to it.
Is this a bug in the Flash compiler? The same exact actions produce different results at random. I'm getting frustrated, as I don't see how I can track down my mistakes if the program detects errors where there aren't any.
Copyright Gary Rosenzweig
