Copy link to clipboard
Copied
Hi
I’ve created a crossword puzzle in AS3 where you have to type in the characters individually into their blocks, for e.g. if the answer is true, you will have to type T into block 1, R into block 2, etc.
My code to test the answer is:
if(true1.text.slice(-2,-1)+true2.text.slice(-2,-1)+true3.text.slice(-2,-1)+ true4.text.slice(-2,-1)=="TRUE") {
answerTrue=true;
} else…
If the answer is incorrect and you press the Backspace button to remove the current character and retype the correct character it works perfect and validates as correct.
BUT if you press the Delete button and you then also retype the correct character it validates it as incorrect. (It only validates as incorrect if you press Delete after the character or if you press it twice.)
Why is the Delete button causing it to break and do you have any suggestions on how I can fix this?
The only other solution I can think of is to just disable the Delete button, but that isn’t as easy as I thought it would be.
Any help will be appreciated.
Copy link to clipboard
Copied
why are you applying the slice method to your textfields and checking the next-to-last character?
Copy link to clipboard
Copied
Thanks, I've changed it to substr(true1.length-1, true1.length) and it works perfect
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now