Frage

I am making an application for iOS and eventually Android with Adobe Air. It's a crossword puzzle. Many crossword puzzles apps/games have this feature where you can tap a letter square and the selected square will highlight along with the rest of the letters in the word. I.e. you tap the first letter square of a five letter word and all letter squares that make up that word highlight.

Another thing many crossword puzzles do is to allow the user to tap the same square again and changing the orientation. If you would for example tap the first letter square in the upper left corner of the puzzle once, it would highlight the word that goes horizontally from the corner. If you would tap that same letter square again, it would highlight the word going vertically.

I have all of this working as intended but my problem lies with the iOS softKeyboard. When the softKeyboard is up it won't register the tap. I have to tap away to hide the softKeyboard and then tap the same letter square again.

The square is just a simple sprite with a TextField on top of it.

Has it something to do with the softKeyboard being up or maybe because the TextField has focus it intercepts the event dispatching?

One interesting thing to note is that when I tap the letter square the second time, with the softKeyboard up and the cursor blinking in the TextField, I get the Paste option hovering above the textfield. Perhaps that is what is intercepting my listener? If so, can it be disabled?

Can somebody shed a light on this?

For the letter square I use

square.addEventListener(TouchEvent.TOUCH_TAP, tileTapped);
War es hilfreich?

Lösung

Mobile AIR apps replace TextInput and TextArea with StageText by default. StageText allows access to native input behaviours (copy/paste, predictive text etc).

To remove this functionality, explicitly define the skin classes for TextInput and/or TextArea:

<s:TextInput skinClass="spark.skins.mobile.TextInputSkin" />
<s:TextArea skinClass="spark.skins.mobile.TextAreaSkin" />

This way StageText will not be used and you wont get the annoying paste option popup

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top