Author: bargull
Date: 2008-12-11 11:23:06 -0800 (Thu, 11 Dec 2008)
New Revision: 12059
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
Log:
Change 20081210-bargull-BWb by bargull at dell--p4--2-53 on 2008-12-10 23:12:37
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: swf9 textformat, again
New Features:
Bugs Fixed: LPP-7333
Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
The last changeset made things a bit worse:
default text format was respected, but html formatting got lost...
So here's the next approach: apparently is only necessary to reset "defaultTextFormat" before setting the new htmlText, that's all.
As a bonus, I've added the implementation for "setPattern" ;-)
Tests:
testcases at bugreport
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as 2008-12-11 18:27:17 UTC (rev 12058)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as 2008-12-11 19:23:06 UTC (rev 12059)
@@ -306,10 +306,9 @@
this.text = t;
var df:TextFormat = this.textfield.defaultTextFormat;
- this.textfield.htmlText = t;
// reset textformat to workaround flash player bug (FP-77)
- this.textfield.setTextFormat(df);
this.textfield.defaultTextFormat = df;
+ this.textfield.htmlText = t;
if (this.resize && (this.multiline == false)) {
// single line resizable fields adjust their width to match the text
@@ -460,7 +459,15 @@
this.textfield.maxChars = val;
}
-function setPattern ( val ){}
+function setPattern (val:String) :void {
+ if (val == null || val == "") {
+ this.textfield.restrict = null;
+ } else if (new RegExp("^\\[.*\\]\\*$").test( val )) {
+ this.textfield.restrict = val.substring(1, val.length - 2);
+ } else if ($debug) {
+ Debug.warn('LzTextSprite.setPattern argument %w must be of the form "[...]*"', val);
+ }
+}
function setSelection(start:Number, end:Number) {
this.textfield.setSelection(start, end);