1

I have a TextArea in a mobile application that I want to force invalidation on a certain event. So far I can do this:

myTextArea.width = myTextArea.width + 1;

I know it works because the text area updates correctly.

I've tried to do it "correctly" using the following:

testing.invalidateProperties();
testing.invalidateDisplayList();
testing.invalidateSize();
testing.validateNow();
parentGroup.invalidateProperties();
parentGroup.invalidateDisplayList();
parentGroup.invalidateSize();
parentGroup.validateNow();

None of the previous code works.

The TextArea is using the StageTextAreaSkin.

UPDATE
This seems to work as well as setting the width but is also a hack and also doesn't sync with the rest of the components:

testing.skin.styleChanged("anything");
eliasah
  • 39,588
  • 11
  • 124
  • 154
1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231
  • What do you expect to happen as a result of the invalidation? If we knew that, perhaps that may be a hint as to why the invalidate methods do not work, but changing the width does. – JeffryHouser Jan 20 '13 at 01:21
  • I'd like it to be repositioned in it's container which is a vgroup in a scroller. It might help to see this related question http://stackoverflow.com/questions/14412301/flex-textarea-and-textinput-on-mobile-not-positioning-correctly – 1.21 gigawatts Jan 20 '13 at 01:42
  • 1
    In Flex, a component is always sized and positioned by its parent. Perhaps you need to invalidate the DisplayList or the parent to you TextArea? Changing the width may force the parent to re-calculate. – JeffryHouser Jan 20 '13 at 02:36
  • I tried that. I updated the post to include code I used. – 1.21 gigawatts Jan 20 '13 at 20:36

1 Answers1

0

The only way I've found to force a validation is to call myTextArea.setStyle("anything_here") or myTextArea.skin.setStyle("anything_here"). Note, it may be the fault of the skin, it is a mobile spark skin from the SDK (not my own creation). Better answers are appreciated.

1.21 gigawatts
  • 16,517
  • 32
  • 123
  • 231