Help with simple tic tac toe Flash game.
New to AS and this has me stumped. Here is my code...
tile1.buttonMode = true;
tile2.buttonMode = true;
tile3.buttonMode = true;
tile4.buttonMode = true;
tile5.buttonMode = true;
tile6.buttonMode = true;
tile7.buttonMode = true;
tile8.buttonMode = true;
tile9.buttonMode = true;
trace("You placed an X");
trace("You placed an O");
The problem is on CLICK it traces out correct and changes the tile to an X like it should. Then when I try to DOUBLE_CLICK I get: "ReferenceError: Error #1069: Property gotoAndStop not found on flash.text.TextField and there is no default value. at ch6_fla::MainTimeline/placeX()" and the tile stays at X.
Like I said I'm pretty new to AS and coding in general so I don't understand what that error means.
I am attaching the file itself so you can see what I have. It's pretty simple but I can't understand why it doesn't work. The file is saved as a .fla 5
You must add the mouse listeners to the buttons instead of the stage, like:
There is a chance you must swap e.target with e.currentTarget in the handlers as well. I don't have the documentation handy right now.
Another solution is to add MouseChildren = false to the buttons, like: tile1.MouseChildren = false; so only the button itself will trigger the event and not any other children objects (like the text) inside them.
That helped and you were right about needing to change to e.currentTarget, that got rid of the error message, but for some reason it's still not displaying anything on DOUBLE_CLICK. It doesn't go to frame 3 (the O) and when I double click it treats it like a single click and traces out "You placed an X". This doesn't make any sense!
That's because you must first enable the doubleClick function on the button (yes I know it's ridiculous) like tile1.doubleClickEnabled = true;
On top of that you will realize that doubleClick will fire single click event as well, so you need something like this http://stackoverflow.com/questions/2...s-double-click
The last thing I needed to do was make it TLF text and read only. Thanks for all the help.
|All times are GMT +1. The time now is 03:49 AM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.