I've been working on my game, and I now have a problem with the text. The code runs fine, but now the text isn't showing up. I've tried for over two hours to find the problem and fix it, but it does not work no matter what way I try it. If someone could go through my FLA and identify why the text isn't displaying, big thanks goes to them!
Last edited by FlashAdrena103; 07-03-2006 at 11:58 AM.
Reason: Problem resolved.
That was a very confusing .fla to look at. I tried to make changes to your code and wonder why they weren't appearing. Then I realized you had two onRelease events triggering your button (an event handler and a clip event) conflicting each other and on top of that, you had two, slightly altered versions of the same checkNumbers() function in two different spots (frames), so you have overriding code all over the place that nullifies previous variables and functions.
The onRelease code on frame 1 is being overridden by the on(release) clip event on your button itself.
As for reasons why your numbers are undefined, there are many:
You've used a reserved word, "_root" as part of the instance name for your input boxes, which is a big no-no. I was wondering why "_root.choice3.text" wasn't working in a trace, then I realized you actually gave "_root" as part of your instance name. So then the only way to access it would be "_root._root.choice3.text" which fails since Flash sees _root as position in a path, not as a name. Rename them without the _root prefix, as in just "choice1", "choice2", etc.
Also your checkNumbers() function on frame 1 is missing an array declaration for the "checkArray" variable, whereas you have it correct on your second version of checkNumbers "checkArray = []".
Because your first checkNumbers() function didn't have an array declaration, that function would always display "undefined" for your numbers. And in the case of the second checkNumbers function, the input box text variables can't be accessed from that frame in anycase, since your input boxes are on a different frame.
But in either case, neither functions, even if coded right, would work because your input boxes had a dysfunctional instance on top of that (because of _root prefix as part of instance name).
I suggest:
1)removing the on(release) clip event on the button itself, and just stick to the onRelease event handler that you have on frame 1.
2)Add the array declaration to your checkNumbers() function on frame 1, so that instead of "checkArray = choice" have "checkArray = new Array()" or "checkArray = []"
3)Rename your input boxes by removing the _root prefix.
4) remove the 2nd checkNumbers() function
Also get in the habit of writing comments marks interspersed through your code so other people can understand your code faster. Was a bit of a pain trying to figure out your logic, especially since you've had repeating and overriding code in multiple places.
Thank you very very much! Big thanks to you! ^________^ I finally got it to work, after changing a couple of things around, so yeah, it works!! Thank you, thank you! You are brilliant!!!!