简体   繁体   中英

flex mobile : textInput does not clear prompt on focus

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.

This is the behaviour on flex mobile (behaviour is OK on swf )

Is that a bug and how to correct that ?

regards

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...

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 here .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM