Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Crossword puzzle - Delete vs. Backspace

New Here ,
Aug 08, 2013 Aug 08, 2013

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.

TOPICS
ActionScript
723
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013

why are you applying the slice method to your textfields and checking the next-to-last character?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2013 Aug 08, 2013

Thanks, I've changed it to substr(true1.length-1, true1.length) and it works perfect

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2013 Aug 08, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines