12 Replies Latest reply: Apr 16, 2013 1:30 PM by Bramblethorne RSS

    AIR 3.2 TextInput - first letter gets cleared by iOS

    andrewbruce01

      I am using iOS (havent tested on android) and the skinClass="spark.skins.mobile.TextInputSkin" and am having an issue when I go to enter text from the soft keyboard. When the text input is empty and I press on a key on the keyboard, that letter enters the text input but it gets highlighted right away by iOS and then the second letter I type overwrites the first. It just happens for the first letter. I tested the same setup on AIR 3.1 and it does not happen so I am thinking its a bug with 3.2

        • 1. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
          iam0815 Community Member

          I have the same Problem: in some cases we have in TextInputs the bahaviour that every time I input a text the whole text in Textinput ist selected. This does only happen when I compile with Air 3.2 - if I use Air 3.1 everything works like expected. This does not happen in TextAreas and some other TextInputs in the same Application.

          In case that the part of the Screen is scrolling where the TextInputs are I changed the skin to: spark.skins.mobile.TextInputSkin

           

           

          Setup:

          SDK: Air 3.2 / Flex 4.6 (combined)

          compiled for iOS only, tested on iPad 2, iOS 5.1

          using the e-skimo-lib for skinning (www.e-skimo.com) -> the Eskimo-Skin has been recompiled with the same SDK.

          • 2. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
            iam0815 Community Member

            A little Update: seems like this has to do with listening on the "change" event - if I replace my listener to compute changes in TextInput control to the focusOut-event it seems to work - this really seems to be a bug in Air 3.2 sdk

            • 3. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
              andrewbruce01 Community Member

              Can you post some code that made it work?

              • 4. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                iam0815 Community Member

                <fx:Script>

                     protected function testTextInput_changeHandler(event:TextOperationEvent):void

                     {

                          // do something

                     }

                 

                     protected function testTextInput_focusOutHandler(event:FocusEvent):void

                     {

                          // do the same

                     }

                </fx:Script>

                 

                <s:TextInput

                          id="testTextInput"

                          skinClass="spark.skins.mobile.TextInputSkin"

                          // did cause the problem:

                          change="testTextInput_changeHandler(event)"

                          // works for me

                          focusOut="testTextInput_focusOutHandler(event)"/>

                • 5. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                  ChristopherTotty Community Member

                  Has anyone else had luck with specifying the skin?  I am also experiencing the issue and when specifying the skinClass the issue persists even if the control has no event listeners at all.

                  • 6. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                    scoregrid Community Member

                    I have the same issue in the new 3.3 beta version. It doesn't seem like anyone is fixing it. This is definitely an issue with the Air 3.2 + compiler. Not ideal is you need the stage3D functionality on mobile.

                    • 7. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                      scoregrid Community Member

                      I also want to point out that this only happens if you have a prompt message. Without a prompt on the field, the inputField works as expected.

                      • 8. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                        scoregrid Community Member

                        The problem is somewhere in SkinnableTextBase. When textDisplay_changeHandler(event:Event) is called, invalidateSkinState() is what's causing the problem. If you set the skin's state to nothing (""), it works:

                        skin.currentState = "";

                        invalidateSkinState();

                         

                        The problem is that your theme doesn't update properly.

                         

                        Now is you set "showPromptWhenFocused" to false in your CSS, the problem doesn't happen. Only side effect is the prompt disapear if you have the textInput selected.

                         

                        s|TextInput{

                            skinClass:ClassReference("spark.skins.mobile.TextInputSkin");

                            showPromptWhenFocused: false;

                        }

                        • 9. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                          ChristopherTotty Community Member

                          This is a complete hack, but it has made it possible to ship Air code on iOS with this issue.

                           

                          We have created a control based on TextInput to use throughout our program that has a change event.  In this change event we do something like the following:

                           

                          if (this.text.length == 1 && flash.system.Capabilities.version.substr(0,3).toUpperCase() == "IOS")

                                                                  {

                                                                                 this.insertText(this.text);  //This does not fire the change event.

                                                                  }

                           

                          So, if the user presses a key, and there is only 1 key, that key will be doubled.  This is not perceptible, so the selected text is immediately cleared with the same text.  All characters added after the first work correctly.

                           

                          Note that all of our TextInputs have a Prompt, so if scoregrid is correct, then this code should be changed to also check for Prompt text.

                          • 10. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                            Bramblethorne Community Member

                            I don't know if this ever was solved for you, but my experience with similar problems is simply that iOS is too stupid -not- to shove a 'clear field' icon into the layout w/o resizing the component.  I automatically make certain to add 50px to the width just to be extra certain the blasted thing doesn't obfuscate my text.   Very very stupid thing to force people to do and there seems to be no programming logic as part of the component or mobile skin that lets you disable the icon or tell the component to recalculate the width automatically.  If it's there, dragging through documentation and searching StackOverflow and the Adobe forums never exposed it to me.

                            • 11. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                              Bramblethorne Community Member

                              Still having this exact problem.

                              • 12. Re: AIR 3.2 TextInput - first letter gets cleared by iOS
                                Bramblethorne Community Member

                                Adding showPromptWhenFocused="false" fixed it for me and it still shows the prompt...  Still... clearly a bug and reported here over a year ago.