Flex 4.6 Text disappears from TextInput as View gets activated

Hi Guys,

This was weirdest problem that I faced while migrating my code base from 4.5 to 4.6 SDK.

When I compile my code with 4.5.1 SDK everything works as per required. But when I compile the same code base with 4.6 then TextInput seems to loose data when my view gets active.

There are couple of quick things that I tried and seems to work.

I think it appears that StageText is active by default in 4.6 so thats messing things up.

I tried couple of things which seems to work.

  1. After setting the value for the TextInput in one of my function I called setFocus() immediately on it and it seems to work, but the more appropriate solution would be (2)
  2. Another thing that I did is to actually have skinClass defined to use TextInputSkin exclusively.

I hope I am making sense if not here is what I did to setup my TextInput skin


 

[geshi lang=”mxml” nums=”1″ target=”_self” ]

I did not do excessive tests on this topic so I cannot really add more to it right now. I hope above works for you. If not then try adobe forums.

Cheers,

Comments

  1. Hi,
    Another solution can be onCreationComplete please include the following code:
    this.addEventListener(FocusEvent.FOCUS_IN,onFocus);
    private function onFocus(event:FocusEvent){
    focusManager.setFocus(txtInput)//txtInput is Id of the textInput
    }

  2. Thanks a Lot for giving such a great solution.

  3. Thank you!
    You really solved my problem.

  4. mattlink03 says

    Hi!, i have the same problems but only when i tested in my android, another problem i have, is when i create a component and i put it in the view, the text of the textfield is over the component i dont know why, and with the beta version of flex didnt happening, i dont know if the reason is the new SDK of the new version 4.6, but with another projects where didnt happen its happening now, any idea why happening?

  5. Wow! I can’t even begin to fathom how many hours you just saved me. Thanks for this great tip.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.