Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
Adobe Flex SDK 3.6 (Release)
-
None
-
Affected OS(s): All OS Platforms
Affected OS(s): All OS Platforms
Language Found: English
Description
Steps to reproduce:
1. Create an mx.controls.Label (this uses mx.core.UITextField)
2. Set the property "truncateToFit" to true.
3. Set the text of the Label to be extremely long (2000 characters)
4. Set the Label to be fairly small, to display around 20-50 characters.
Actual Results:
UITextField is inefficient and truncates the string one character at a time instead of actually trying to make a initial best guess and truncating from there on.
Expected Results:
UITextField should do a best guess truncation and then strip one character at a time. I believe this was the intended behavior.
Workaround (if any):
I've attached a fix for it. Here's a description of each file:
1) UITextField_TruncateToFit_Bug.zip: Flex 3 project that demonstrates the inefficiency with truncateToFit.
2) UITextField_Flex3.0_fix.as: Modified version of UITextField.as file from the Flex 3.0 SDK with my bug fix. The code that changed is in the truncateToFit method.
3) UITextField_orig_vs_fixed.txt: This has code on what exactly changed. Notice that in the original code, it call "originalText.slice" but doesn't assign it to anything.
I checked out a couple Flex 3.X SDKs and noticed that the truncateToFit code is buggy in all of them (3.0.0.477, 3.5, 3.6.0.13443).