FLEX-33537: Updated to force properties to be validated before setting the focus to the textDisplay. This seems to stop it tripping over itself with the visible skin states.
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/b29975cc Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/b29975cc Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/b29975cc Branch: refs/heads/master Commit: b29975cc08515531f9e51f6681baf23f94f3ef50 Parents: 094b9a5 Author: Mark Kessler <kesslerconsult...@gmail.com> Authored: Wed Nov 18 20:38:51 2015 -0500 Committer: Mark Kessler <kesslerconsult...@gmail.com> Committed: Wed Nov 18 20:38:51 2015 -0500 ---------------------------------------------------------------------- .../supportClasses/SkinnableTextBase.as | 24 +++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/b29975cc/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as b/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as index 388135d..abb6dfb 100644 --- a/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as +++ b/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as @@ -1875,6 +1875,9 @@ public class SkinnableTextBase extends SkinnableComponent } else { + //Force properties to validate before resetting focus. + validateProperties(); + textDisplay.setFocus(); } } @@ -2692,18 +2695,23 @@ public class SkinnableTextBase extends SkinnableComponent */ private function textDisplay_changeHandler(event:Event):void { - //trace(id, "textDisplay_changeHandler", textDisplay.text); - // The text component has changed. Generate an UPDATE_COMPLETE event. invalidateDisplayList(); - + + // We may have gone from empty to non-empty or vice-versa. This should // cause the prompt to show or hide. - if (prompt != null && prompt != "" && skin && skin.currentState && - (skin.currentState.indexOf("WithPrompt") != -1 && text.length != 0 || - skin.currentState.indexOf("WithPrompt") == -1 && text.length == 0)) - invalidateSkinState(); - + if (prompt != null && prompt != "" && skin && skin.currentState) + { + //Checks when to invalidate skin. However when component is focused (and not prompt with focus) it will not have "WithPrompt". Broken out for clarity. + if (skin.currentState.indexOf("WithPrompt") != -1 && text.length != 0 || + skin.currentState.indexOf("WithPrompt") == -1 && text.length == 0) + { + invalidateSkinState(); + } + } + + // Redispatch the event that came from the RichEditableText. dispatchEvent(event); }