20907

flex mobile : textInput does not clear prompt on focus

Question:

a simple

<s:TextInput x="163" y="117" prompt="hello"/>

Does not clear the prompt on focus, but clears the prompt when user first type in a letter.

<strong>This is the behaviour on flex mobile</strong> (behaviour is OK on swf )

Is that a bug and how to correct that ?

regards

Answer1:

There May be an-other way to get rid of that, but my approach is that you may add a focusIn event and do some thing like :

<s:TextInput id="textInput" x="10" y="24" prompt="Enter SomeThing" focusIn="textinput1_focusInHandler(event)"/> <fx:Script> <![CDATA[ protected function textinput1_focusInHandler(event:FocusEvent):void { // TODO Auto-generated method stub textInput.prompt = ""; } ]]> </fx:Script>

may that should work for you...

Answer2:

www.Flextras.com is on the right path. I had the same issues with TextInput on iPad where the field wouldn't display as a password when I needed it to.

All you need to do is manually apply the mobile TextInput skin.

<s:TextInput x="163" y="117" skinClass="spark.skins.mobile.TextInputSkin" prompt="hello"/>

You can see the answer provided to me in a separate question <a href="https://stackoverflow.com/questions/11419068/ios-textinput-displayaspassword-doesnt-displayaspassword" rel="nofollow">here</a>.

Answer3:

Actually the solution to hide prompt on focus is pretty easy, just add a style declaration like this

s|TextInput{ showPromptWhenFocused: false; }

or in a class

.noPromptOnFocus{ showPromptWhenFocused: false; }

If you use the second approach, your TextInput should look something like

<s:TextInput id="myTextInput" prompt="Write something here.." styleName="noPromptWhenFocused" />

This works fine no matter if you're using StageText or the TextInputSkin.

Recommend

  • How can I watermark a DateField control in Flex 4?
  • The text is rendering clipped ignoring isStretchWithOverflow property value using PDF exporter
  • XML file with DTD displays fine in web browser after invalid change
  • JasperReports: Subreport renders multiple times, causing duplicate pages
  • Flex DataGrid with row number column
  • Android MVVM with Programmatic UI Customization
  • Focus / blur events on contenteditable elements
  • jquery set xml cdata
  • Convert matlab.graphics.primitive.Image (output of imagesc) to rgb array
  • Binding a custom handler twice in knockoutjs
  • Alert prompt to function not working in react native
  • XSLT escaping >
  • AS3 String Memory Leak
  • JavaScript In KML Ignored By Google Earth Plugin
  • Textfield Mandatory On basis of radio button selection- Yii2
  • Stall when debugging with gdbserver in VSCode - “The preLaunchTask 'docker gdb' cannot be
  • Use pnorm from Rmath.h with Rcpp
  • Cocos2D set sprite position in relation to another sprite
  • Tag and Element shortcuts - Sublime Text 2
  • Insert multiple values into hidden field
  • Mootools accordion with a Next button inside each pane
  • how to display   in Mozilla using XSL.
  • Kivy, TypeError: 'NoneType' object has no attribute '__getitem__'
  • (Tcl/Expect) clear screen after exit
  • Scanner nextInt() and hasNextInt() problems
  • jQuery: How to AJAXify WordPress Search?
  • Trying to get the char code of ENTER key
  • JQuery Internet Explorer and ajaxstop
  • DomPDF {PAGE_NUM} not on first page
  • Javascript simulate pressing enter in input box
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Importing jscolor library in angular 2
  • A cron job substitute?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Java static initializers and reflection
  • How to stop GridView from loading again when I press back button?
  • Android Google Maps API OnLocationChanged only called once
  • Linking SubReports Without LinkChild/LinkMaster
  • UserPrincipal.Current returns apppool on IIS