views:

33

answers:

2

I have a project where a big part of the UI a notebook, where the user enters text in a number of fields, for which it uses a series of TextInput components. Once the notebook is filled in the user switches to a screen where the inputs are disabled and they compare what they wrote to a 'model answer'. The problem is that the last TextInput to have focus at the time of disabling retains it - it appears disabled (greyed out etc) but if you type the letters appear in the field.

I have tried variations on Selection.setFocus(null), and it seems that Selection.getFocus() returns null/undefined, but can still type into it. I can't select any of the other textfields, and clicking on other interactive elements - bottons etc doesn't seem to want to remove focus either.

UPDATE - Just to make sure there wasn't something crazy happening particular to this project, if I make a nude flash movie with a textInput and a button, then make the button set theTextInput.enabled = false, I can still type into the field. I can't see any way that's a feature.

ANOTHER UPDATE - This is a compiled component or whatever they call that - am I able to actually look at some source anywhere?

A: 

I have not had experience specifically with this problem, however as a "hackish" work-around you could add an additional out-of-view "focus"able element and explicitly set the focus on that element when the user switches screens.

sberry2A
I had that same idea, but doesn't seem to work. There is something Funny happening Somewhere.
Andrew
A: 

Ok, so part of me wants to downvote myself for this, but:

What ended up working was destroying the reference to the actual textfield in the component, like:

myTextInput.label = undefined

This only works because I never need to switch them back on again, but I couldn't retrieve the value of the text entered later on, so I needed to do this bit of nonsense:

var s:String = myTextInput.text;
myTextInput.label = {text:s};

If anyone has any Sensible Ideas, I would like to hear them, but this seems to be doing the job.

Andrew