Skip navigation
andrewbruce01
Currently Being Moderated

AIR 3.2 TextInput - first letter gets cleared by iOS

Apr 3, 2012 7:40 PM

Tags: #ios #textinput #air3.2

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

 
Replies
  • Currently Being Moderated
    Apr 5, 2012 7:58 AM   in reply to andrewbruce01

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 9:45 AM   in reply to andrewbruce01

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 10:18 AM   in reply to andrewbruce01

    <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)"/>

     
    |
    Mark as:
  • Currently Being Moderated
    May 2, 2012 8:47 AM   in reply to iam0815

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2012 12:02 AM   in reply to andrewbruce01

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2012 12:10 AM   in reply to andrewbruce01

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2012 3:32 AM   in reply to andrewbruce01

    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;

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 20, 2012 8:04 AM   in reply to scoregrid

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 19, 2013 9:52 AM   in reply to andrewbruce01

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2013 1:25 PM   in reply to Bramblethorne

    Still having this exact problem.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 16, 2013 1:30 PM   in reply to Bramblethorne

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points