FIXED - FLEX-34231 StageText displays wrong text
Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/063dcdc2 Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/063dcdc2 Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/063dcdc2 Branch: refs/heads/master Commit: 063dcdc244e89ba2e0e435880b619813b4666184 Parents: c5b0ff1 Author: mamsellem <[email protected]> Authored: Mon Apr 21 23:08:55 2014 +0200 Committer: mamsellem <[email protected]> Committed: Mon Apr 21 23:08:55 2014 +0200 ---------------------------------------------------------------------- .../supportClasses/ScrollableStageText.as | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/063dcdc2/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as index c03ef69..da971cc 100644 --- a/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as +++ b/frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ScrollableStageText.as @@ -1736,14 +1736,20 @@ public class ScrollableStageText extends UIComponent implements IStyleableEdita { restoreStageText(); } - else if (savedSelectionAnchorIndex > 0 || savedSelectionActiveIndex > 0) + else { - // Even if the StageText has been retrieved from the cache, its - // selection is not preserved. Restore the selection if necessary. - if (savedSelectionAnchorIndex <= _text.length && savedSelectionActiveIndex <= _text.length) - stageText.selectRange(savedSelectionAnchorIndex, savedSelectionActiveIndex); - savedSelectionAnchorIndex = 0; - savedSelectionActiveIndex = 0; + //always restore text, even if recycled, as it may have changed when the SST was not on stage cf. https://issues.apache.org/jira/browse/FLEX-34231 + // for now, we ignore external changes to other props + stageText.text = _text ; + if (savedSelectionAnchorIndex > 0 || savedSelectionActiveIndex > 0) + { + // Even if the StageText has been retrieved from the cache, its + // selection is not preserved. Restore the selection if necessary. + if (savedSelectionAnchorIndex <= _text.length && savedSelectionActiveIndex <= _text.length) + stageText.selectRange(savedSelectionAnchorIndex, savedSelectionActiveIndex); + savedSelectionAnchorIndex = 0; + savedSelectionActiveIndex = 0; + } } if (stageText != null)
