TextInputs, StageTexts, & Scrollers (oh my!)

Any scrollers I’ve used (up until today) on mobile devices have been through lists, so I have created my own custom ItemRenderers.

Well, today I decided to be lazy and just add TextInput controls, along with labels and spacers, directly into a VGroup.

Compiled, debugged, and tested, all will great success….. until I tried to actually put text in the text boxes!!!
If you enter text, you get very odd text placement, and often the text will disappear entirely:



Well fancy that!

I did some digging and found out it’s intentionally this way, for performance reasons.  The parent component for TextInput and TextArea is StageText, which really REALLY hates scrollers (must have done something to StageText as a child!).

It’s a pretty straightforward fix: Adobe provides a custom skin that will heal the hatred, and all you need to do is reference it, like so:

@namespace s "library://ns.adobe.com/flex/spark";
.myTextInputStyle {
skinClass: ClassReference("spark.skins.mobile.TextInputSkin");
.myTextAreaStyle {
skinClass: ClassReference("spark.skins.mobile.TextAreaSkin");


Then add a reference to your TextInput / Text Area Field:


<s:TextInput id="txtSignName" width="415" styleName="myTextInputStyle"/>



I get the logic behind it – mostly because let’s face it, how often are you NOT going to reskin / use an ItemRenderer?- but it’s still pretty troublesome to find the solution.
(btw, I got the answer from the Adobe Flex 4.6 reference, found here)

I’m curious to see down the road, as processors get faster in tablets, what the default settings will be. I suspect we’ll find that settings/optimizations like this will become increasingly rare as performance improves.



One Response to TextInputs, StageTexts, & Scrollers (oh my!)

  1. Rahul Joshi says:

    Hi Strack,

    I too faced the same issue but if we use the Skin as you have specified, it won’t have stageText feautres lik: auto-correct, autoCapitalize etc.
    Also If I check the Adobe Help here: http://help.adobe.com/en_US/flex/mobileapps/WS82181550ec4a666a39bafe0312d9a274c00-8000.html#WS19f279b149e7481cc0874e1331d30586a-7fff
    They say that we need to specify skin like that to get StageText features, but in my case I lose them.