Kindly have a look at the attached file. The Big window displays a word and if I type the same in the box labelled "Ans", I should get a message saying that the displayed and inputted texts match. Instead I just keep getting "Incorrect". Can't figure why?
Secondly, the program is supposed to loop through the program twice as can easily be seen. The timings are correct the first time through and the second time through the loop, except that at the start of the second loop, for the very first word, word 1, the time for which it is displayed, is just 1 second whereas it should be about 5 seconds as is for all the words after and for that matter before it.
Without really going to town on your code, you need to give boxAns.text its instance name of boxAns, I'm sure there is some other things that could fine tune, but that will get you going.
I would also recommend not using the vars on the text field variable box, instead use textfield.text = myVar, but it's your choice sir.
Thanks for the reply. I tried the boxAns but it did not work. I guess it got left unchanged in the file. So I have tried to get the myWord to match the myAns using the variable myAns as well as using a boxAns.text instance. I did give the input textbox the instance name when i tried it. I have used that once again by not using the vars on the text field variable, yet no success in getting them to match.
Thanks for the post with the file but I beg to say that I have Flash version CS3. Is there any way that you could save that in a lower version. I would be grateful. or maybe you can send me the AS2 code in a text file and I'll go thru the same and try in it my fla. (unless th fla itself is modified).
Quote " Your file was a tad mixed up, perhaps this will be enlightening ". - fruitbeard.
That's a scary line. I admit I am a novice but was the program so bad?
OK, CS3 , its very awkward for me to do it for CS3, so this is the last time, CS5 and above for me, you will need to update to open my files from now.
Yes Sir, Thank you. Will upgrade. Will also be glad to check and see the conflicts that I caused. I tried a whole lot, almost a day, to get the timing error eliminated but failed.
Will revert once I have checked the file out. Thanks very much for all the trouble.
So i just went through the file and it is works fine except that the functionality is different from what I have tried to achieve in the file I sent. Actually it's my fault and I should have mentioned the functionality that I was trying to achieve. I thought that running my file would demonstrate it but I guess it was subtle.
What I wanted was that the word be displayed for 4 seconds and then be removed for the next 4 seconds ( dispBlank) but during the entire duration( 8 seconds or so - 4 seconds of word displayed and 4 seconds of blank displayed), the user would have a chance to input the word and the spellings would be matched at the end and the correct / incorrect message displayed accordingly before the next word was displayed. That way I can change the duration of the words for which the word is flashed on the screen and then the user gets a chance to type it back in ( you know like checking if the words is remembered and spelled correctly by the user.)
But now after looking at your code and comparing with mine I feel that there would be a problem of matching since the bigText would have to be changed to a blank to make it disappear and that would never make bigText.Text == myWord. Some sort of improvisation will have to be made. Maybe like use another variable into whom the bigText.Text value is stored before bigText is set to blank.
That's the reason I used the wait etc. and an additional Timeout / SetInterval. Kindly look at the code again in light of this functionality and get it timed correct.
Thanks very much.
PS. I still do not have the CS5 but I will upgrade very soon. Please send a text file of the code if the CS3 is a hassle. Thanks.
I don't have time right now, however, if you look at the code you will notice I use the vars too, i just set the text to dsiplay the vars, the vars remain the same until next word, so kindly get it timed correct.
The reason I was not getting a match between the displayed and the user input was exactly as mentioned in the last message. Assigning the "" ( blank ) value to myWord to clear the word after 4 seconds was foiling the match. The small improvisation I mentioned in the last message got it working. I owe this to you again since your code made me think of this.
I simply did :
myWord = v_word[word];
myCheckWord = myWord;
and then using this value to check for a match
if(myCheckWord == myAns)
instead of if(myWord == myAns)
and lo I got the match. So there is no need to use the box instance name. Just the variable names work fine.
Now it's an issue of the timing that I request you to look into.
Thanks for the reply. I have found one more error in my code which has improved the situation somewhat but not fully rectified it. I had made a mistake in the if then conditional loops in dispWord(). I was using :
if( word == MaxWords ) {... }
which is ok and then using
if(word <= Maxwords) {... }
which was wrong and I changed it to
if(word < Maxwords) {... }
With this the first word in the array, going second time through the loop is displayed for the right time. Earlier it was displaying for a very short time almost just 1 second.
However now the blank is displayed for a lesser time ( only for the first word looping second time) as compared to the blank displayed for the rest of the words. The blank for the first word is almost between 2-3 seconds as compared to 5 seconds for the rest of the words.
I am attaching the new file too for you to check out.
I'll be glad if you would figure this out.
Yea perfect. The code was sweet, succinct and clear. Wish I could think straight like you. I know this is solved but it still baffles me as to what is causing that small glitch in my code. If you have time then I would request you to look at it again and see where it's going wrong. I am sure you would be able to spot it in no time. It would be a great lesson in debugging for me.
Hi fruitbeard,
Please do not bother to find that glitch. I just managed to find the flaw. Did prove to be a great debugging lesson. Thanks very much again for all your help.